API Keys
Create API Key
Generate a new API key for programmatic access to DialNexa. The secret is returned only once at creation.
POST
Create an API key
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.
The
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:
Body parameters
| Field | Description |
|---|---|
name | Display name for the new key, for example Production Server or Acme CRM Integration. |
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.
Request
Response
secret field appears only in this response. Store it in your secrets manager before continuing.
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
Pass your API key as a Bearer token in the Authorization header.
Body
application/json
Response
201 - application/json
API key created. The secret field is only returned in this response.
Create an API key