Skip to main content

Overview

API keys are managed under /api/token. These endpoints use the system access token described in Authentication and quota.
PUT /api/token/ performs a full mutable-settings update, not a JSON Merge Patch. Include every setting that must be preserved.

Mutable fields

Create a standard API key

A successful create response does not include the record ID. Use a unique name, then locate the new record through list or search. Standard-key lists exclude Smart Routing keys by default:
Set exclude_smart_routing=false to include every key:
Supported page-size parameter names are size, page_size, and ps. The maximum page size is 100. Search by name or stored key value:
The optional token query parameter accepts a key with or without the sk- prefix. List, search, and read responses always mask the key value.

Read and reveal

Read a masked record:
Reveal the complete stored value:
Reveal endpoints return the stored value without adding sk-. Treat the response as a secret and write it directly to a secrets manager rather than printing it. Reveal up to 100 keys in one request:

Safely update a key

Read the current record, construct a complete mutable payload, and change only the intended values:
This read-modify-write pattern preserves model limits and Smart Routing settings.

Enable or disable

Status-only updates preserve all other settings:
An expired or exhausted key cannot be enabled until its expiration or quota condition is corrected.

Delete keys

Delete one key:
Delete multiple owned keys:
The batch response data value is the number of records actually deleted.

Complete lifecycle script

This script creates a one-hour key with a USD-denominated ceiling, locates it, reveals it without logging the secret, updates it, disables it, and deletes it.