PATCH /v1/account/keys/{key_id}
Update an API key's details.
- Method: PATCH
- Path: /v1/account/keys/{key_id}
- Auth: Bearer token (provisioning key) in Authorizationheader
- Content-Type: application/json
Path Parameters
- key_id(integer, required): The ID of the API key to update
Request Parameters
All parameters are optional. Only include the fields you want to update:
- name(string, optional): New name for the API key (1-255 characters)
- is_enabled(boolean, optional): Enable or disable the API key
- credit_limit(number, optional): Update credit limit for the API key (minimum: 0, or null to remove limit)
Example Request
- Python
- Node.js
- cURL
import requests
key_id = 1
response = requests.patch(
    f"https://api.naga.ac/v1/account/keys/{key_id}",
    headers={
        "Authorization": "Bearer YOUR_PROVISIONING_KEY",
        "Content-Type": "application/json"
    },
    json={
        "name": "Updated Production Key",
        "is_enabled": False,
        "credit_limit": 200.00
    }
)
updated_key = response.json()
print(updated_key)
const keyId = 1;
const response = await fetch(`https://api.naga.ac/v1/account/keys/${keyId}`, {
  method: "PATCH",
  headers: {
    "Authorization": "Bearer YOUR_PROVISIONING_KEY",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    name: "Updated Production Key",
    is_enabled: false,
    credit_limit: 200.00
  })
});
const updatedKey = await response.json();
console.log(updatedKey);
curl -X PATCH https://api.naga.ac/v1/account/keys/1 \
  -H "Authorization: Bearer YOUR_PROVISIONING_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Updated Production Key",
    "is_enabled": false,
    "credit_limit": 200.00
  }'
Response
{
  "id": 1,
  "name": "Updated Production Key",
  "created_at": "2025-01-15T10:30:00Z",
  "is_enabled": false,
  "credit_limit": 200.00
}
Authentication
Provide your provisioning key as a Bearer token:
Authorization: Bearer YOUR_PROVISIONING_KEY
Response Fields
- id(integer): Unique key identifier
- name(string): Updated key name
- created_at(string): ISO 8601 timestamp (unchanged)
- is_enabled(boolean): Updated key status
- credit_limit(number | null): Updated spending limit