Skip to main content
POST
/
api
/
v1
/
accounts
/
{account_id}
/
users
/
{user_id}
/
keys
Create API key
curl --request POST \
  --url http://localhost:9001/api/v1/accounts/{account_id}/users/{user_id}/keys \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "key_name": "Production API Key",
  "scopes": [
    "read",
    "write"
  ]
}
'
{
  "success": true,
  "data": {
    "id": "apikey-abc123-v1",
    "key_name": "Production API Key",
    "raw_key": "aion_sk_live_abc123xyz789...",
    "scopes": [
      "read",
      "write"
    ],
    "created_at": "2023-11-07T05:31:56Z"
  }
}

Authorizations

Authorization
string
header
required

JWT token from Auth0

Path Parameters

account_id
string
required

Account's external ID (format: acct-xxx-v1)

Example:

"acct-xyz789-v1"

user_id
string
required

User's external ID (format: user-xxx-v1)

Example:

"user-abc123-v1"

Body

application/json
key_name
string
required

Display name for the API key

Example:

"Production API Key"

scopes
string[]

Permission scopes for the key

Example:
["read", "write"]

Response

API key created successfully

success
boolean
Example:

true

data
object