Create and restrict an API key
Set the key access mode explicitly. New keys default to admin access, subject to the caller's access cap.
Choose access
| Mode | Access |
|---|---|
read-only | Read requests, including supported analytics query operations |
write | Reads and configuration writes |
admin | Reads, writes and deletion |
A key does not grant access beyond your account membership and resource permissions. Resource grants, teams and capability grants also affect access.
Create a key
- Sign in and choose your account context.
- Use your account-context bearer credential to create a key. Set
accessModetowritefor the setup tasks. Useread-onlyfor an integration that only reads. - Store the returned secret securely as
BALANCER_API_KEYfor subsequent examples. Do not include it in support requests.
Use https://<your-api-host> as your API base URL. The host is shown in the Balancer portal. Examples use $BALANCER_API_KEY for an existing credential with the required access.
curl --fail-with-body -sS -X POST "https://<your-api-host>/user/api-keys" \
-H "Authorization: Bearer $BALANCER_API_KEY" \
-H "Content-Type: application/json" \
--data '{"apiKey":{"name":"setup","accessMode":"write"}}'
API reference: Create an API key for your account user
Expect HTTP 200 with data.apiKey, including accessMode, expiresOn and the new secret. The secret is omitted here.
- Read the key metadata to verify that
accessModeiswrite:
curl --fail-with-body -sS -X GET "https://<your-api-host>/user/api-keys" \
-H "x-api-key: $BALANCER_API_KEY"
API reference: Returns your account user's API keys
Expect HTTP 200 with data.apiKeys. Match the key name and check its mode. Set an explicit expiresOn timestamp when you need expiry. Expired or revoked keys cannot authenticate.
TODO(verify): Confirm whether key-specific resource scoping is supported beyond accessMode and the caller's account and resource grants.
API reference
Need Help?
Contact your NetActuate account manager.