curl https://api.naga.ac/v1/account/keys/42 \
-X PATCH \
-H "Authorization: Bearer $NAGA_PROVISIONING_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "production (rotated out)",
"is_enabled": false
}'import requests
url = "https://api.naga.ac/v1/account/keys/{key_id}"
payload = {
"name": "production (rotated out)",
"is_enabled": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: 'production (rotated out)', is_enabled: false})
};
fetch('https://api.naga.ac/v1/account/keys/{key_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.naga.ac/v1/account/keys/{key_id}"
payload := strings.NewReader("{\n \"name\": \"production (rotated out)\",\n \"is_enabled\": false\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"id": 42,
"name": "production (rotated out)",
"created_at": "2026-08-01T09:14:22",
"expires_at": null,
"is_enabled": false,
"default_routing_strategy": "latency",
"credit_limit": 25
}{
"error": {
"type": "invalid_request_error",
"message": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "invalid_request_error",
"message": "Invalid provisioning key."
}
}{
"error": {
"type": "invalid_request_error",
"message": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "invalid_request_error",
"message": "<string>",
"code": "<string>",
"param": "<string>"
}
}Update an API key
Updates one API key of the account in place, changing only the fields sent. Requires a provisioning key.
curl https://api.naga.ac/v1/account/keys/42 \
-X PATCH \
-H "Authorization: Bearer $NAGA_PROVISIONING_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "production (rotated out)",
"is_enabled": false
}'import requests
url = "https://api.naga.ac/v1/account/keys/{key_id}"
payload = {
"name": "production (rotated out)",
"is_enabled": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: 'production (rotated out)', is_enabled: false})
};
fetch('https://api.naga.ac/v1/account/keys/{key_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.naga.ac/v1/account/keys/{key_id}"
payload := strings.NewReader("{\n \"name\": \"production (rotated out)\",\n \"is_enabled\": false\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"id": 42,
"name": "production (rotated out)",
"created_at": "2026-08-01T09:14:22",
"expires_at": null,
"is_enabled": false,
"default_routing_strategy": "latency",
"credit_limit": 25
}{
"error": {
"type": "invalid_request_error",
"message": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "invalid_request_error",
"message": "Invalid provisioning key."
}
}{
"error": {
"type": "invalid_request_error",
"message": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "invalid_request_error",
"message": "<string>",
"code": "<string>",
"param": "<string>"
}
}Authorizations
An account provisioning key. Send it as Authorization: Bearer <key>. Provisioning keys manage the account and cannot reach a model.
Path Parameters
The key's id, as the listing reports it.
Body
The body of PATCH /v1/account/keys/{key_id}; an absent field stays.
A new default routing strategy, or null to let NagaAI choose. An unknown name draws a 400.
reliability, balanced, latency, throughput, cache A replacement label, between 1 and 255 characters. An explicit null draws a 400.
Whether the key works at all. A disabled key draws a 401 disabled_api_key.
A replacement spending limit in credits, or null to clear it.
A later expiry, or null to clear it.
Response
The key as it stands after the change, without its secret.
One API key of the account, without its secret.
The key's id, which is the {key_id} the per-key routes take.
The label the key carries.
When the key was created: UTC to the second, without an offset.
When the key stops working, or null for one that never expires.
Whether the key works at all.
The key's own spending limit in credits, or null for none.
The key's default routing strategy, or null when NagaAI chooses.
reliability, balanced, latency, throughput, cache