Skip to main content
POST
Create a new API key for an organization
Legacy endpoint - deprecated. Unversioned endpoints are scheduled for removal on July 31, 2026. A public v1 replacement is not currently listed in the v1 reference. This endpoint remains available for existing integrations until then.
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 Keyslast_used_at field, then revoke the old one.

Authentication

Use the returned secret as a Bearer token in the Authorization header on every API request:

Errors

  • 400 Bad Request is returned when the name field is missing or empty.
  • 403 Forbidden is returned when the caller does not have permission to create API keys.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Headers

x-organization-id
string
required

RSA encrypted organization ID (base64 format)

Example:

"BASE64_ENCRYPTED_ORG_ID_HERE"

Body

application/json
name
string
required

Label for the API key

Example:

"Docs Key"

expire_now
boolean

Expire previous key immediately if true, else in 24 hours

Example:

false

Response

201 - application/json

API key created