Skip to main content

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 Authorization header
  • 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

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)

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