Skip to content
会nokai.studio

API keys

Auth: Authorization: Bearer zpk_... required.


GET /v1/api-keys

List all keys for the account. Returns metadata only -- the raw secret is never shown after issuance.

Response 200

{
  "data": [
    {
      "id": "key_uuid",
      "customer_id": "cust_uuid",
      "channel_id": null,
      "name": "production-server",
      "prefix": "zpk_live_abcd",
      "scopes": [],
      "last_used_at": "2026-05-29T10:00:00Z",
      "expires_at": null,
      "created_at": "2026-01-01T00:00:00Z",
      "revoked_at": null
    }
  ]
}

POST /v1/api-keys

Issue a new API key. The secret field in the response is shown once only -- store it immediately.

Request body

{
  "name": "production-server",
  "scopes": [],
  "expires_at": null
}
FieldTypeRequiredNotes
namestringyes1-120 chars.
channel_idstringnoBind key to one channel for least-privilege.
scopesstring[]noFuture use; pass [] or omit.
expires_atISO datetimenoKey auto-revokes after this date.

Response 201

{
  "id": "key_uuid",
  "customer_id": "cust_uuid",
  "channel_id": null,
  "name": "production-server",
  "prefix": "zpk_live_abcd",
  "scopes": [],
  "last_used_at": null,
  "expires_at": null,
  "created_at": "2026-05-29T12:00:00Z",
  "revoked_at": null,
  "secret": "zpk_live_abcdefghijklmnopqrstuvwxyz0123456789ABCD"
}

secret is only present in this response. It cannot be retrieved again.


DELETE /v1/api-keys/:id

Revoke a key. Takes effect immediately -- all requests using the revoked key return 401.

Path param

ParamTypeNotes
idUUIDThe key id from the list endpoint.

Response 200

Returns the revoked key metadata with revoked_at set.

Errors

StatusMeaning
404Key not found or belongs to another account.