Skip to main content
POST
/
auth
/
keys
Create a new API key
curl --request POST \
  --url http://localhost:3000/auth/keys \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: <api-key>' \
  --data '
{
  "name": "<string>",
  "permissions": {
    "read": true,
    "write": false,
    "admin": false
  },
  "scope": {},
  "expiresAt": "2023-11-07T05:31:56Z",
  "rateLimit": 1000
}
'
{
  "success": true,
  "data": {
    "key_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "key_prefix": "<string>",
    "name": "<string>",
    "permissions": {
      "read": true,
      "write": true,
      "admin": true
    },
    "scope": {},
    "status": "active",
    "created_at": "2023-11-07T05:31:56Z",
    "last_used": "2023-11-07T05:31:56Z",
    "rate_limit": 123
  }
}

Authorizations

X-API-Key
string
header
required

API key for authentication. Format: zdb_your_api_key_here

Body

application/json
name
string
required

Name for the API key

Required string length: 1 - 255
permissions
object
scope
object

Resource scope limitations

expiresAt
string<date-time>

Expiration date for the API key

rateLimit
integer
default:1000

Rate limit for this API key

Required range: 1 <= x <= 10000

Response

API key created successfully

success
boolean
data
object