hzel
ReferenceStructures

ApiTokenView

The personal access token object returned by PAT endpoints.

ApiTokenView is the safe public projection of a personal access token (PAT). The raw token value and its hash are never included — the raw token is returned only once at creation time as part of CreateTokenResponse.

ApiTokenView fields

FieldTypeDescription
idstring (UUID)Unique token identifier. Pass this to DELETE /api/v1/tokens/{token_id} to revoke.
namestringHuman-readable label chosen at creation time (e.g. "ci-deploy").
prefixstringFirst 16 characters of the raw token value (display only). Prefix hzel_.
last_used_atstring (ISO 8601) | nullUTC timestamp of the last successful authentication using this token. null if the token has never been used.
expires_atstring (ISO 8601) | nullAbsolute expiry timestamp. null if the token never expires.
created_atstring (ISO 8601)UTC timestamp when the token was created.
revoked_atstring (ISO 8601) | nullUTC timestamp when the token was revoked. null if the token is still active.

Example (ApiTokenView)

{
  "id": "c9d8e7f6-0000-0000-0000-000000000001",
  "name": "ci-deploy",
  "prefix": "hzel_AbCdEfGhIjKlMnOp",
  "last_used_at": "2025-06-20T08:00:00Z",
  "expires_at": "2026-12-31T00:00:00Z",
  "created_at": "2025-06-15T09:00:00Z",
  "revoked_at": null
}

CreateTokenResponse

Returned only by POST /api/v1/tokens. Contains all ApiTokenView fields plus the one-time token field, serialized as a flat object.

FieldTypeDescription
tokenstringThe raw token value — returned only at creation. Prefix hzel_. Store it immediately.
(all ApiTokenView fields)See above.
{
  "token": "hzel_AbCdEfGhIjKlMnOpQrStUvWxYz01234567",
  "id": "c9d8e7f6-0000-0000-0000-000000000001",
  "name": "ci-deploy",
  "prefix": "hzel_AbCdEfGhIjKlMnOp",
  "last_used_at": null,
  "expires_at": "2026-12-31T00:00:00Z",
  "created_at": "2025-06-15T09:00:00Z",
  "revoked_at": null
}