Skip to main content
POST
https://api.naga.ac
/
v1
/
account
/
keys
Create API Key
curl --request POST \
  --url https://api.naga.ac/v1/account/keys \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "<string>",
  "credit_limit": {},
  "expires_at": {}
}
'
{
  "id": 123,
  "name": "<string>",
  "key": "<string>",
  "created_at": "<string>",
  "expires_at": {},
  "is_enabled": true,
  "credit_limit": {},
  "message": "<string>"
}
Store Securely The API key is only shown once during creation. Store it securely as it cannot be retrieved again.
Provisioning Key Required This endpoint requires authentication with a provisioning key, not a regular API key.

Request Parameters

name
string
required
Name for the API key (1-255 characters)
credit_limit
number | null
Optional credit limit for the API key (minimum: 0). Use null to remove the limit.
expires_at
string | null
Optional expiration datetime for the API key (ISO 8601). Must be in the future. Use null to remove expiration.

Usage examples

import requests

response = requests.post(
    "https://api.naga.ac/v1/account/keys",
    headers={
        "Authorization": "Bearer YOUR_PROVISIONING_KEY",
        "Content-Type": "application/json",
    },
    json={
        "name": "New Production Key",
        "credit_limit": 500.00,
    },
)

key_data = response.json()
print(f"New API Key: {key_data['key']}")
print(f"Key ID: {key_data['id']}")

Response

{
  "id": 3,
  "name": "New Production Key",
  "key": "naga_sk_1234567890abcdef",
  "created_at": "2025-01-20T15:45:00Z",
  "expires_at": "2026-01-20T15:45:00Z",
  "is_enabled": true,
  "credit_limit": 500.0,
  "message": "Store this key securely. It will not be shown again."
}

Response Fields

id
integer
Unique key identifier
name
string
Key name
key
string
The actual API key (only shown once)
created_at
string
ISO 8601 timestamp
expires_at
string | null
Optional expiration datetime (ISO 8601). null means no expiration.
is_enabled
boolean
Whether the key is active
credit_limit
number | null
Optional spending limit (null means no limit)
message
string
Security reminder