API Reference
API Keys

API Keys API

Create and manage API keys for programmatic access.

List API Keys

GET /v1/api-keys

Scope required: admin or read-only

Query Parameters

ParameterTypeDescription
limitintegerMaximum results (default 50, max 100)
cursorstringPagination cursor

Response

{
  "api_keys": [
    {
      "id": "tnu_ak_abc123",
      "name": "Production Authorizer",
      "scopes": ["authorizer"],
      "status": "active",
      "created_at": "2024-01-15T10:00:00Z",
      "expires_at": null,
      "last_used_at": "2024-01-15T12:30:00Z"
    }
  ],
  "total": 1,
  "cursor": null
}

Create API Key

POST /v1/api-keys

Scope required: admin

Request Body

FieldTypeRequiredDescription
namestringYesHuman-readable name
scopesarrayYesArray of scopes
expires_atstringNoExpiration in RFC3339 format

Example

curl -X POST "https://api.tenuo.cloud/v1/api-keys" \
  -H "Authorization: Bearer tc_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Production Authorizer",
    "scopes": ["authorizer"],
    "expires_at": "2024-04-15T10:00:00Z"
  }'

Response

{
  "id": "tnu_ak_abc123",
  "name": "Production Authorizer",
  "key": "tc_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  "scopes": ["authorizer"],
  "status": "active",
  "created_at": "2024-01-15T10:00:00Z",
  "expires_at": "2024-04-15T10:00:00Z"
}
⚠️

The key field is only returned once at creation time. Store it securely.

Get API Key

GET /v1/api-keys/{id}

Scope required: admin or read-only

Response

{
  "id": "tnu_ak_abc123",
  "name": "Production Authorizer",
  "scopes": ["authorizer"],
  "status": "active",
  "created_at": "2024-01-15T10:00:00Z",
  "expires_at": "2024-04-15T10:00:00Z",
  "last_used_at": "2024-01-15T12:30:00Z",
  "request_count": 1542
}

Revoke API Key

POST /v1/api-keys/{id}/revoke

Revoke an API key immediately.

Scope required: admin

Response

{
  "id": "tnu_ak_abc123",
  "status": "revoked",
  "revoked_at": "2024-01-15T12:00:00Z"
}

Delete API Key

DELETE /v1/api-keys/{id}

Permanently delete an API key.

Scope required: admin