K8 HQ

Access tokens — K8 HQ Sign-in API

Access tokens operations for K8 HQ Sign-in API. Requests, permissions and responses.

Version 1OpenAPI description (JSON)

Browse operation groups

Before making requests, read the authentication and request requirements.

Create and revoke your own access tokens for scripts, AI agents and integrations. Owners and admins can also list and revoke any token in the organization.

Base URL

Base URLFor
https://api.k8hq.com/authThe K8 HQ web app, and programs acting with a person's session

Endpoints

Access tokens

List my tokens

GET/v1/account/tokens

The person's access tokens in every organization (never their secrets), and per organization what they may give a new one. Bounded HTTP descendants are returned in pages of at most 8 evaluated index rows. Follow nextCursor even when a page has no matching tokens. Send it as cursor on the same listing; each agent page rechecks current authority. Legacy token metadata appears on the first page.

For a person's own session (x-k8hq-token) only: assistants' delegated tokens and API tokens are refused.

Parameters

NameTypeDescription
cursor (query)stringContinuation for this exact user, organization, app and listing action; grants no authority.
orgId (query)stringAgent requests select one organization. Required when the issuer covers multiple organizations; humans retain their account-wide listing.

Response body (JSON)

FieldTypeDescription
orgs requiredobject[]
tokens requiredToken[]
nextCursorstringOmitted only when descendant enumeration is complete.

Responses

StatusBodyMeaning
200JSONTheir tokens and organizations.
400application/problem+jsonThe request is malformed or a field is invalid (invalid).
401application/problem+jsonNo session, or it expired or was revoked (unauthenticated): refresh, or sign in again.
403application/problem+jsonNot allowed (forbidden): an assistant's delegated token, or a browser origin other than the web app's.
405application/problem+jsonMethod not allowed. The Allow header lists supported methods.
500application/problem+jsonA temporary problem (unavailable); retry.

Create a token

POST/v1/account/tokens

Makes an access token for the person in one organization, for the content API (api), mail apps (imap, smtp) or both. A token acts for its member with the member's current access, never more: every scope must be one they may give (see issuable in List my tokens), and every container one they're in. A person may have 20 tokens.

The secret (k8hq_<token ID>_<secret>) is in this answer only; K8 HQ keeps just a hash.

When personal app admission is enabled, an app bearer credential may create only a bounded personal HTTP descendant with Idempotency-Key, preset: "custom", orgId, and either an explicit permission/capability ceiling or supported named-container HTTP scopes. Expiry defaults to 30 days, accepts 1–90 days, and cannot exceed the original human authorization deadline. The complete requested-resource capture supports at most 20 distinct named resources and may refuse a unit that cannot fit the single 100-item capture. Browser issuers need no manual_copy flow. The first confirmed acceptance returns a copy-once k8m1_ secret; replay/status return only safe token metadata. Legacy mail protocols, unbounded expiry and legacy presets are unsupported for app issuers.

Needs a passkey confirmation of this change (x-k8hq-confirm: token.create). Until confirmations are enforced, a passkey sign-in in the last five minutes also works. The API-token scope tags:create is an explicit choice, never part of a preset. Only a current owner or admin who holds tags.create can grant it. It always needs a passkey confirmation naming the new token. Each create checks the member’s current role and permission again and the token can create up to 50 tags. To give this scope to an existing token, create a new token.

For a person's own session (x-k8hq-token) only: assistants' delegated tokens and API tokens are refused. The session needs a recent passkey: if its last passkey confirmation is more than 5 minutes old, the answer is 401 step_up_required.

Parameters

NameTypeDescription
x-amz-content-sha256 (header) requiredstringThe body's SHA-256, lowercase hex. CloudFront signs requests to this service and refuses a POST without it (403, not a problem detail). For {}: 44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a.

Request body (JSON)

FieldTypeDescription
preset requiredemail | custom
containerIdsstring[]For custom: containers to narrow it to, all in the organization.
expiresInDaysinteger1 to 3650; -1 for never; 0 or absent for the preset's default.
inboxIdstringFor email: the inbox the mail app signs in to.
labelstringUp to 100 characters; defaults to mail app or token.
orgIdstringThe organization; may be left out when containerIds or inboxId name it.
scopesstring[]For custom.
{"containerIds":["ibx_01J..."],"expiresInDays":30,"label":"Backup script","orgId":"org_01J...","preset":"custom","scopes":["api","messages:read"]}

Response body (JSON)

FieldTypeDescription
secret requiredstringThe full token to send as Authorization: Bearer. Pattern: ^k8hq_tok_.
token requiredToken

Responses

StatusBodyMeaning
200JSONThe token and, this once, its secret.
400application/problem+jsonThe request is malformed or a field is invalid (invalid).
401application/problem+jsonNo session or it expired (unauthenticated), or confirm this change with your passkey (confirmation_required; until confirmations are enforced, step_up_required with action, which a passkey use in the last 5 minutes also satisfies): the answer carries the action to confirm and a short summary.
403application/problem+jsonThey can't make tokens in the organization, or give one of the scopes (forbidden); or a delegated token or foreign origin.
404application/problem+jsonThey have no access to a container, or aren't a member (not_found).
405application/problem+jsonMethod not allowed. The Allow header lists supported methods.
409application/problem+jsonThey have 20 tokens already, their access to the inbox needs updating, or who can do what in the organization changed meanwhile (conflict).
500application/problem+jsonA temporary problem (unavailable); retry.

Revoke my token

DELETE/v1/account/tokens/{id}

Revokes one of the person's own tokens; it stops working at once.

For a person's own session (x-k8hq-token) only: assistants' delegated tokens and API tokens are refused.

Parameters

NameTypeDescription
x-amz-content-sha256 (header) requiredstringThe body's SHA-256, lowercase hex. CloudFront signs requests to this service and refuses a POST without it (403, not a problem detail). For {}: 44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a.
id (path) requiredstringResource ID.

Response body (JSON)

FieldTypeDescription
ok requiredtrue

Responses

StatusBodyMeaning
200OkRevoked.
400application/problem+jsonThe request is malformed or a field is invalid (invalid).
401application/problem+jsonNo session, or it expired or was revoked (unauthenticated): refresh, or sign in again.
403application/problem+jsonNot allowed (forbidden): an assistant's delegated token, or a browser origin other than the web app's.
404application/problem+jsonNot one of their tokens (not_found).
405application/problem+jsonMethod not allowed. The Allow header lists supported methods.
409application/problem+jsonWho can do what in the organization changed meanwhile (conflict): nothing was revoked; try again.
500application/problem+jsonA temporary problem (unavailable); retry.

List an organization's tokens

GET/v1/organizations/{orgId}/tokens

Every token in the organization, for its owners and admins (tokens.manage_all). Bounded HTTP descendants are returned in pages of at most 8 evaluated index rows. Follow nextCursor even when a page has no matching tokens. Send it as cursor on the same listing; each agent page rechecks current authority. Legacy token metadata appears on the first page.

For a person's own session (x-k8hq-token) only: assistants' delegated tokens and API tokens are refused.

Parameters

NameTypeDescription
orgId (path) requiredstringOrganization ID.
cursor (query)stringContinuation for this exact user, organization, app and listing action; grants no authority.

Response body (JSON)

FieldTypeDescription
tokens requiredOrgToken[]
nextCursorstringOmitted only when descendant enumeration is complete.

Responses

StatusBodyMeaning
200JSONThe tokens.
400application/problem+jsonThe request is malformed or a field is invalid (invalid).
401application/problem+jsonNo session, or it expired or was revoked (unauthenticated): refresh, or sign in again.
403application/problem+jsonThey can't see the organization's tokens (forbidden).
405application/problem+jsonMethod not allowed. The Allow header lists supported methods.
500application/problem+jsonA temporary problem (unavailable); retry.

Revoke an organization's token

DELETE/v1/organizations/{orgId}/tokens/{id}

Revokes any token in the organization, for its owners and admins. Only owners revoke an owner's tokens.

For a person's own session (x-k8hq-token) only: assistants' delegated tokens and API tokens are refused.

Parameters

NameTypeDescription
x-amz-content-sha256 (header) requiredstringThe body's SHA-256, lowercase hex. CloudFront signs requests to this service and refuses a POST without it (403, not a problem detail). For {}: 44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a.
orgId (path) requiredstringOrganization ID.
id (path) requiredstringResource ID.

Response body (JSON)

FieldTypeDescription
ok requiredtrue

Responses

StatusBodyMeaning
200OkRevoked.
400application/problem+jsonThe request is malformed or a field is invalid (invalid).
401application/problem+jsonNo session, or it expired or was revoked (unauthenticated): refresh, or sign in again.
403application/problem+jsonThey can't revoke it (forbidden).
404application/problem+jsonNo such token in the organization (not_found).
405application/problem+jsonMethod not allowed. The Allow header lists supported methods.
409application/problem+jsonWho can do what in the organization changed meanwhile (conflict): nothing was revoked; try again.
500application/problem+jsonA temporary problem (unavailable); retry.