API Keys
Manage project API keys (sk_ab_*) for authenticating proxy requests.
Auth: Session token or platform key with X-Workspace-Id header.
List API Keys
GET /v1/platform/api-keys
Returns all active API keys for the workspace.
No parameters.
const keys = await billing.apiKeys.list()Response
{
"data": [
{
"id": "ak_0a1b2c3d4e5f6g7h8i9j0k1",
"name": "Production",
"suffix": "z789",
"lastAccessedAt": "2025-01-15T12:30:00.000Z"
}
]
}| Field | Type | Required | Description |
|---|---|---|---|
id | string | Always | Key identifier (ak_0*) |
name | string | Always | Display name |
suffix | string | Always | Last characters of the key (for display) |
lastAccessedAt | string? | Always | ISO 8601 last use, or null |
Create an API Key
POST /v1/platform/api-keys
Create a new API key. The full key is only returned once.
Body Parameters
| Name | Type | Required | Description |
|---|---|---|---|
name | string | No | Display name. Default: "Untitled" |
const { key, id } = await billing.apiKeys.create({ name: 'Production' })
// Store key securely — it cannot be retrieved againResponse
{
"id": "ak_0a1b2c3d4e5f6g7h8i9j0k1",
"key": "sk_ab_live_xyz789abc456def123"
}Store the
keyvalue securely -- it cannot be retrieved again.
Revoke an API Key
DELETE /v1/platform/api-keys/:id
Permanently deactivate an API key. Revoked keys return 401 on all requests.
Path Parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Yes | The key ID to revoke |
await billing.apiKeys.revoke('ak_0a1b2c3d4e5f6g7h8i9j0k1')Response
{ "success": true }| Status | Cause |
|---|---|
| 404 | Key not found or doesn't belong to this workspace |