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": 123
}
'
{
  "id": 123,
  "name": "<string>",
  "key": "<string>",
  "created_at": "<string>",
  "is_enabled": true,
  "credit_limit": 123,
  "message": "<string>"
}
Store Securely The API key is only shown once during creation. Store it securely as it cannot be retrieved again.

Request Parameters

name
string
required
Name for the API key (1-255 characters)
credit_limit
number
Optional credit limit for the API key (minimum: 0)

Example Request

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",
  "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
is_enabled
boolean
Key status (always true for new keys)
credit_limit
number
Optional spending limit
message
string
Security reminder