Networking Minerva User Guide

Configure an API Key

Requests to NVIDIA Minerva APIs, such as the NVIDIA Minerva NVLink API, are authenticated with an API key, sent in the X-API-Key header. You don't need the key when you use the API from a browser that's signed in to the NVIDIA Minerva UI.

NVIDIA Minerva does not issue the key: an administrator creates one and configures it on the platform. Until a key is configured, the backend APIs, including the NVIDIA Minerva NVLink API under /nmx/v1, accept requests without authentication. Don't expose the platform to untrusted networks until you configure a key.

The commands on this page are for a Docker Swarm installation.

Set the API Key

On the platform manager node:

  1. Back up the UI configuration file:

    cp ~/opt/minerva/var/ui/ui.json ~/opt/minerva/var/ui/ui.json.pre-apikey
    
  2. Generate a random key and set it as API_KEY in ui.json:

    KEY=$(openssl rand -hex 32)
    python3 - ~/opt/minerva/var/ui/ui.json "$KEY" <<'EOF'
    import json, sys
    f, key = sys.argv[1], sys.argv[2]
    d = json.load(open(f)); d["API_KEY"] = key
    json.dump(d, open(f, "w"), indent=2)
    EOF
    
  3. Restart the UI:

    docker service update --force ui_ui
    
  4. Display the key, and store it securely. You need it for every API request.

    echo "$KEY"
    

Verify the API Key

Wait about 20 seconds. Then, in the same shell, send a request without the key and one with it. Replace <platform-address> with the platform's IP address or FQDN:

curl -sk -o /dev/null -w '%{http_code}\n' https://<platform-address>/nmx/v1/gpus/count
curl -sk -o /dev/null -w '%{http_code}\n' -H "X-API-Key: $KEY" https://<platform-address>/nmx/v1/gpus/count

The first request returns 403 and the second returns 200. If both return 403, check that a valid license is installed (see Manage Licenses).

Remove the API Key

Restore the backup, and then restart the UI:

cp ~/opt/minerva/var/ui/ui.json.pre-apikey ~/opt/minerva/var/ui/ui.json
docker service update --force ui_ui

Last updated: