API Keys
Create API Key
deprecated
Generate a new API key for programmatic access to DialNexa. The secret is returned only once at creation.
POST
Create a new API key for an organization
Generates a new API key. The secret value is returned only once: in the response of this call. DialNexa does not store the secret in a recoverable form, so if you lose it you must revoke the key with Revoke API Key and create a new one. Keys are scoped to the workspace they are created in and inherit the permissions of the caller that created them.
When to use this
- First-time setup: issue the initial key for a new environment.
- New consumer service: issue a dedicated key for each upstream service so you can revoke them independently if needed.
- Planned rotation: issue the next key as the first step in the Key rotation playbook.
- Environment separation: keep production, staging, and development keys distinct so a leak in one environment does not compromise the others.
Best practices
- One key per environment. Create separate keys for development, staging, and production so revocation never takes down more than one environment at a time.
- One key per consumer service. If multiple services share a key, a leak forces you to rotate every consumer at once. Per-service keys narrow the blast radius.
- Never commit keys to source control. Use environment variables or a secrets manager. Keys accidentally pushed to a public repository should be revoked immediately, even if you delete the commit.
- Rotate periodically. Issue a new key, deploy it everywhere it is needed, verify traffic on the new key through List API Keys’
last_used_atfield, then revoke the old one.
Authentication
Use the returned secret as a Bearer token in theAuthorization header on every API request:
Errors
400 Bad Requestis returned when thenamefield is missing or empty.403 Forbiddenis returned when the caller does not have permission to create API keys.
Related endpoints
- List API Keys: review every key on the workspace.
- Rename API Key: change a key’s display name.
- Revoke API Key: permanently retire a key.
- Key rotation: recommended sequence for rotating keys without downtime.
- Authentication: how keys are sent and verified.
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
RSA encrypted organization ID (base64 format)
Example:
"BASE64_ENCRYPTED_ORG_ID_HERE"
Body
application/json
Response
201 - application/json
API key created
Create a new API key for an organization