Assistant Billing

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"
    }
  ]
}
FieldTypeRequiredDescription
idstringAlwaysKey identifier (ak_0*)
namestringAlwaysDisplay name
suffixstringAlwaysLast characters of the key (for display)
lastAccessedAtstring?AlwaysISO 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

NameTypeRequiredDescription
namestringNoDisplay name. Default: "Untitled"
const { key, id } = await billing.apiKeys.create({ name: 'Production' })
// Store key securely — it cannot be retrieved again

Response

{
  "id": "ak_0a1b2c3d4e5f6g7h8i9j0k1",
  "key": "sk_ab_live_xyz789abc456def123"
}

Store the key value 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

NameTypeRequiredDescription
idstringYesThe key ID to revoke
await billing.apiKeys.revoke('ak_0a1b2c3d4e5f6g7h8i9j0k1')

Response

{ "success": true }
StatusCause
404Key not found or doesn't belong to this workspace