REST API Reference

API Keys Endpoints

Manage programmatically generated API keys, view active key hashes, and revoke stale credentials.

POST

/api/api-keys

Generates a new raw API key prefixed with cz_live_. The raw secret is only displayed once upon creation.

Request
curl -X POST https://api.cloudizero.com/api/api-keys \
  -H "Cookie: authjs.session-token=..." \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Production Backend Worker",
    "workspaceId": "ws_LXAlEW70v24YSc0y",
    "projectIds": ["prj_LXAlEW70v24YSc0y"]
  }'
Response (200 OK)
{
  "id": "key_W5ZwCHs1pwAP2Hmt",
  "name": "Production Backend Worker",
  "key": "cz_live_9f8ab2e4b830d9...",
  "workspaceId": "ws_LXAlEW70v24YSc0y",
  "projectId": "prj_LXAlEW70v24YSc0y",
  "projectIds": ["prj_LXAlEW70v24YSc0y"],
  "createdAt": "2026-10-12T12:00:00Z"
}
One-time Display
The plain-text API key is never stored in the database. Store it immediately in a secure vault or environment manager.
GET

/api/api-keys

Lists all active API keys associated with the account, including masked key prefixes, scoped project associations, and last-used timestamps.

Request
curl -X GET https://api.cloudizero.com/api/api-keys \
  -H "Cookie: authjs.session-token=..."
Response (200 OK)
[
  {
    "id": "key_W5ZwCHs1pwAP2Hmt",
    "name": "Production Backend Worker",
    "keyPrefix": "cz_live_9f8ab2e4...",
    "workspaceId": "ws_LXAlEW70v24YSc0y",
    "workspaceName": "Acme Engineering",
    "projectId": "prj_LXAlEW70v24YSc0y",
    "projectName": "Storefront Production",
    "projects": [
      { "id": "prj_LXAlEW70v24YSc0y", "name": "Storefront Production" }
    ],
    "lastUsedAt": "2026-10-21T18:30:00Z",
    "createdAt": "2026-10-12T12:00:00Z"
  }
]
GET

/api/api-keys/[keyId]

Retrieves granular details for a specific API key, including workspace authorization scope, attached projects list, and cumulative accessible storage volume.

Request
curl -X GET https://api.cloudizero.com/api/api-keys/key_W5ZwCHs1pwAP2Hmt \
  -H "Cookie: authjs.session-token=..."
Response (200 OK)
{
  "id": "key_W5ZwCHs1pwAP2Hmt",
  "name": "Production Backend Worker",
  "keyPrefix": "cz_live_9f8ab2e4...",
  "workspace": {
    "id": "ws_LXAlEW70v24YSc0y",
    "name": "Acme Engineering",
    "slug": "acme-engineering",
    "isPersonal": false
  },
  "isGlobal": false,
  "isWorkspaceWide": false,
  "projects": [
    {
      "id": "prj_LXAlEW70v24YSc0y",
      "name": "Storefront Production",
      "totalSize": 14285700,
      "fileCount": 128
    }
  ],
  "lastUsedAt": "2026-10-21T18:30:00Z",
  "createdAt": "2026-10-12T12:00:00Z"
}
DELETE

/api/api-keys/[keyId]

Revokes and permanently deletes an API key via the path parameter /api/api-keys/[keyId] (or query parameter ?keyId=...). Revoked tokens immediately lose all platform access.

Request
curl -X DELETE "https://api.cloudizero.com/api/api-keys/key_W5ZwCHs1pwAP2Hmt" \
  -H "Cookie: authjs.session-token=..."
Response (200 OK)
{
  "success": true,
  "message": "API key revoked"
}