Assistiv Docs

API Keys

Manage platform and end-user API keys. Platform keys (sk-plat_*) control management operations. End-user keys (sk-eu_*) control runtime operations like chat completions and tool use.

GET/v1/platforms/{platformId}/api-keys

Returns a paginated list of API keys for the platform.

Auth: Platform key.

Query Parameters

NameTypeRequiredDescription
typestringOptional"platform" or "end_user". Filters by key type.Default: "platform"
pageintegerOptionalPage number.Default: 1
limitintegerOptionalItems per page. Max 100.Default: 20

The key_prefix (first 8 chars) is the only part of the key visible after creation. Full key hashes are never exposed.

bash
# List platform keys
curl "https://api.assistiv.ai/v1/platforms/{platformId}/api-keys?type=platform" \
  -H "Authorization: Bearer sk-plat_your_key"

# List end-user keys
curl "https://api.assistiv.ai/v1/platforms/{platformId}/api-keys?type=end_user" \
  -H "Authorization: Bearer sk-plat_your_key"
json
{
  "data": [
    {
      "id": "uuid",
      "platform_id": "uuid",
      "key_prefix": "sk-plat_f",
      "name": "Default key",
      "scopes": [],
      "is_active": true,
      "last_used_at": "2026-04-08T10:30:00Z",
      "expires_at": null,
      "created_at": "2026-01-01T00:00:00Z"}
  ],
  "total": 1, "page": 1, "limit": 20
}
POST/v1/platforms/{platformId}/api-keys

Creates a new platform API key.

Auth: Platform key.

Request Body

NameTypeRequiredDescription
namestringOptionalKey display name. 1-100 chars.
scopesstring[]OptionalPermission scopes. Defaults to ["inference"] if omitted.
expires_atstringOptionalISO 8601 expiration timestamp. Omit for no expiry.

One-time display

The raw_key is only included in the creation response. Store it securely immediately.

bash
curl -X POST https://api.assistiv.ai/v1/platforms/{platformId}/api-keys \
  -H "Authorization: Bearer sk-plat_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "CI/CD key",
    "scopes": ["inference"],
    "expires_at": "2027-01-01T00:00:00Z"
  }'
json
{
  "id": "uuid",
  "key_prefix": "sk-plat_a",
  "name": "CI/CD key",
  "scopes": ["inference"],
  "is_active": true,
  "created_at": "2026-04-08T10:30:00Z",
  "raw_key": "sk-plat_a1b2c3d4e5f6..."}
POST/v1/platforms/{platformId}/api-keys

Creates an end-user API key. Include end_user_id to create an end-user key instead of a platform key.

Auth: Platform key.

Request Body

NameTypeRequiredDescription
end_user_idstringRequiredUUID of the end user this key belongs to.
namestringOptionalKey display name. 1-100 chars.
scopesstring[]OptionalPermission scopes. Defaults to ["inference"].
expires_atstringOptionalISO 8601 expiration timestamp.
bash
curl -X POST https://api.assistiv.ai/v1/platforms/{platformId}/api-keys \
  -H "Authorization: Bearer sk-plat_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "end_user_id": "end-user-uuid",
    "name": "Mobile app key",
    "expires_at": "2027-01-01T00:00:00Z"
  }'
GET/v1/platforms/{platformId}/api-keys/{keyId}

Retrieves an API key by ID. Returns metadata only (never the raw key).

Auth: Platform key.

bash
curl https://api.assistiv.ai/v1/platforms/{platformId}/api-keys/{keyId} \
  -H "Authorization: Bearer sk-plat_your_key"
PATCH/v1/platforms/{platformId}/api-keys/{keyId}

Updates a key's name or revokes it. Setting is_active to false revokes — Redis cache invalidated immediately.

Auth: Platform key.

Query Parameters

NameTypeRequiredDescription
typestringOptional"end_user" when updating an end-user key.

Request Body (all optional)

NameTypeRequiredDescription
namestringOptionalUpdated display name.
is_activebooleanOptionalSet to false to revoke.
bash
# Revoke an end-user key
curl -X PATCH "https://api.assistiv.ai/v1/platforms/{platformId}/api-keys/{keyId}?type=end_user" \
  -H "Authorization: Bearer sk-plat_your_key" \
  -H "Content-Type: application/json" \
  -d '{ "name": "Renamed", "is_active": false }'
DELETE/v1/platforms/{platformId}/api-keys/{keyId}

Soft-deletes (revokes) an API key. Takes effect immediately via Redis cache invalidation.

Auth: Platform key. Returns 204 No Content.

Query Parameters

NameTypeRequiredDescription
typestringOptional"end_user" when deleting an end-user key.
bash
curl -X DELETE "https://api.assistiv.ai/v1/platforms/{platformId}/api-keys/{keyId}?type=end_user" \
  -H "Authorization: Bearer sk-plat_your_key"