Sessions — K8 HQ Sign-in API
Sessions operations for K8 HQ Sign-in API. Requests, permissions and responses.
Version 1OpenAPI description (JSON)
Before making requests, read the authentication and request requirements.
Refresh, confirm and end sessions. Use these to keep an access token fresh and to confirm a recent passkey before sensitive changes.
Base URL
| Base URL | For |
https://api.k8hq.com/auth | The K8 HQ web app, and programs acting with a person's session |
Endpoints
Sessions
Sign out of this browser
DELETE/v1/account/browser-sessions
Forget this browser's server sign-out (design note 0034): advances this browser's revocation epoch, so every session that signed in with this browser's partitionSecret ends at once, anyone's, this one included; a sign-in completing at the same moment fails with browser_changed and is tried again. This session must have signed in with that secret. A repeat, once this session has ended because the browser was signed out after it started, answers 200 again. The audit event access.browser.signed_out goes to each of the person's organizations (or their own scope beyond 48). Not available to assistants.
For a person's own session (x-k8hq-token) only: assistants' delegated tokens and API tokens are refused.
Parameters
| Name | Type | Description |
x-amz-content-sha256 (header) required | string | The 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)
| Field | Type | Description |
partitionSecret required | string | This browser's secret, the one this session signed in with. Pattern: ^[A-Za-z0-9_-]{43}$. |
{"partitionSecret":"q0d8J3k5ZQyL2b9sV7mXrT1uW4nC6hA0eF8gP2iK5oM"}
Response body (JSON)
| Field | Type | Description |
ok required | true | |
Responses
| Status | Body | Meaning |
| 200 | Ok | Every session in this browser has ended, this one included. |
| 400 | application/problem+json | partitionSecret is missing or isn't a browser secret (invalid). |
| 401 | application/problem+json | No session, or it expired or was revoked (unauthenticated): refresh, or sign in again. |
| 403 | application/problem+json | Not allowed (forbidden): an assistant's delegated token, or a browser origin other than the web app's. |
| 405 | application/problem+json | Method not allowed. The Allow header lists supported methods. |
| 409 | application/problem+json | This session can't sign the browser out: it signed in from this browser before its storage was reset (browser_mismatch), or it's from before browser secrets (browser_unbound). Nothing was signed out. Sign this session out with DELETE /v1/account/session; for browser_mismatch the browser's other sessions remain until Sign out everywhere or they expire. Also conflict: the account changed meanwhile; try again. |
| 500 | application/problem+json | A temporary problem (unavailable); retry. |
Sign out
DELETE/v1/account/session
Ends this session: its access and refresh tokens stop working at once (other services check revocation on every request).
For a person's own session (x-k8hq-token) only: assistants' delegated tokens and API tokens are refused.
Parameters
| Name | Type | Description |
x-amz-content-sha256 (header) required | string | The 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. |
Response body (JSON)
| Field | Type | Description |
ok required | true | |
Responses
| Status | Body | Meaning |
| 200 | Ok | Signed out. |
| 401 | application/problem+json | No session, or it expired or was revoked (unauthenticated): refresh, or sign in again. |
| 403 | application/problem+json | Not allowed (forbidden): an assistant's delegated token, or a browser origin other than the web app's. |
| 405 | application/problem+json | Method not allowed. The Allow header lists supported methods. |
| 409 | application/problem+json | Your account changed meanwhile (another passkey, session or name change won the race), so nothing was changed (conflict); reload and try again. |
| 500 | application/problem+json | A temporary problem (unavailable); retry. |
Sign out everywhere
DELETE/v1/account/sessions
Ends every session of the person's, and revokes their API tokens in every organization. Their mail app tokens (IMAP and SMTP only) keep working unless mailApps is true.
For a person's own session (x-k8hq-token) only: assistants' delegated tokens and API tokens are refused.
Parameters
| Name | Type | Description |
x-amz-content-sha256 (header) required | string | The 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)
| Field | Type | Description |
mailApps | boolean | Also revoke mail app tokens. |
{"mailApps":false}
Response body (JSON)
| Field | Type | Description |
ok required | true | |
Responses
| Status | Body | Meaning |
| 200 | Ok | Signed out everywhere. |
| 401 | application/problem+json | No session, or it expired or was revoked (unauthenticated): refresh, or sign in again. |
| 403 | application/problem+json | Not allowed (forbidden): an assistant's delegated token, or a browser origin other than the web app's. |
| 405 | application/problem+json | Method not allowed. The Allow header lists supported methods. |
| 409 | application/problem+json | Some tokens couldn't be revoked yet because who can do what in their organization kept changing, or your account changed meanwhile (another passkey, session or name change won the race) (conflict): not signed out everywhere; try again. |
| 500 | application/problem+json | A temporary problem (unavailable); retry. |
Begin a confirmation
POST/v1/confirm/begin
Starts a passkey confirmation of one change (action) or an ordered list of up to 5 different changes (actions), or up to 20 when every change moves an address to a new inbox or changes an inbox's addresses, as the routes described them in their confirmation_required answers. Send exactly one form. Every change must belong to the same sign-in and organization; account changes can be listed only with other account changes. Address descriptions bind the method and route through their operation (add, status, delete or move), the source inbox, address, endpoint and current status where present, and the destination inbox for a move. Returns the passkey request, whose challenge commits to the whole ordered list of canonical descriptions, and a summary listing every change in K8 HQ's words with names it looked up. The challenge lasts 5 minutes. A person's own session only, never an assistant's. At most 30 a person every 10 minutes.
For a person's own session (x-k8hq-token) only: assistants' delegated tokens and API tokens are refused.
Parameters
| Name | Type | Description |
x-amz-content-sha256 (header) required | string | The 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)
| Field | Type | Description |
action | Action | |
actions | Action[] | Up to 5 changes, or up to 20 when every kind is address.change or inbox.promote. |
{"action":{"kind":"member.role","org":"org_01J...","params":{"fromRole":"member","role":"admin"},"sid":"ses_01J...","sub":"usr_01J...","svc":"auth","target":"mem_01J...","v":1}}
Response body (JSON)
| Field | Type | Description |
challengeId required | string | Valid 5 minutes, once. Pattern: ^chl_. |
options required | object | For navigator.credentials.get(): the person's own passkeys, user verification required. |
summaries required | string[] | |
summary required | string | Every action's summary, one line each. |
Responses
| Status | Body | Meaning |
| 200 | JSON | The passkey request and what it confirms. |
| 400 | application/problem+json | Not a change K8 HQ can confirm, another session's change, mixed organizations, repeated changes or too many changes of these kinds (invalid_action), or malformed (invalid). |
| 401 | application/problem+json | No session, or it expired or was revoked (unauthenticated): refresh, or sign in again. |
| 403 | application/problem+json | Not allowed (forbidden): an assistant's delegated token, or a browser origin other than the web app's. |
| 429 | application/problem+json | Too many confirmations begun (rate_limited). |
| 500 | application/problem+json | A temporary problem (unavailable); retry. |
Finish a confirmation
POST/v1/confirm/finish
Checks the passkey's answer (the same person's passkey, user verified, over the challenge naming the actions, from the same session), records access.action.confirmed and a security notice to the person, and returns the confirmation: send it in x-k8hq-confirm with the change, within 2 minutes. Reuse the same confirmation for each listed request. Each request still checks current permissions and must match its listed description. Each entry can be used once, even when requests run at the same time; a replay returns confirmation_used and a request outside the list returns confirmation_mismatch. The two-minute expiry applies to the whole list and is never extended by use. A confirmation never counts as a recent passkey use. For seven days after recovery, bound actions in organizations with another owner become pending changes. Answers 202 with changes after the passkey check. Another owner approves through the existing changes routes; repeat the confirmation in the same session, then retry the original request. Each approval permits one confirmation of exactly the described action. Lists wait for all approvals. Adding a destination or turning off the key copy is refused during the seven days.
For a person's own session (x-k8hq-token) only: assistants' delegated tokens and API tokens are refused.
Parameters
| Name | Type | Description |
x-amz-content-sha256 (header) required | string | The 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)
| Field | Type | Description |
challengeId required | string | |
credential required | object | The passkey's answer (PublicKeyCredential.toJSON()). |
{"challengeId":"chl_01J...","credential":{"id":"...","response":{},"type":"public-key"}}
Response body (JSON)
| Field | Type | Description |
confirmation required | string | Send it in x-k8hq-confirm. |
expiresAt required | string | |
Responses
| Status | Body | Meaning |
| 200 | JSON | The confirmation. |
| 202 | JSON | Waiting for another owner to approve. No confirmation was issued. |
| 400 | application/problem+json | Malformed, or the challenge is unknown, expired, used or another session's, or the passkey's answer couldn't be read (invalid). |
| 401 | application/problem+json | No session or it expired (unauthenticated), or the passkey isn't recognized or isn't theirs. |
| 403 | application/problem+json | Not allowed (forbidden): an assistant's delegated token, or a browser origin other than the web app's. |
| 409 | application/problem+json | The approval request was declined, expired or already used. Review the change and try again. |
| 429 | application/problem+json | Too many failed passkey ceremonies from this address (rate_limited). |
| 500 | application/problem+json | A temporary problem (unavailable); retry. |
Refresh a session
POST/v1/refresh
Exchanges a refresh token for a new access token and a new refresh token. Each refresh token works once: presenting one again (or two requests racing with the same one) ends the whole session, since it was copied. A refreshed access token keeps the session's last passkey confirmation time, so it doesn't satisfy a recent-passkey check. A successful refresh from a network the account has not used in 90 days creates the same new-network security notice as a sign-in. Repeated use of a known network does not create another notice. Notice failures are logged without failing the refresh.
No sign-in needed.
Parameters
| Name | Type | Description |
x-amz-content-sha256 (header) required | string | The 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)
| Field | Type | Description |
refreshToken required | string | |
{"refreshToken":"..."}
Response body (JSON)
| Field | Type | Description |
tokens required | Tokens | |
Responses
| Status | Body | Meaning |
| 200 | JSON | New tokens; keep the new refresh token, the old one is spent. |
| 400 | application/problem+json | No refresh token (invalid). |
| 401 | application/problem+json | The refresh token is unknown, spent or its session ended (unauthenticated): sign in again. |
| 403 | application/problem+json | Not allowed (forbidden): an assistant's delegated token, or a browser origin other than the web app's. |
| 500 | application/problem+json | A temporary problem (unavailable); retry. |
Start a passkey confirmation
POST/v1/stepup/begin
Asks the signed-in person to confirm with one of their own passkeys, for actions that need a recent one (marked on each call; they answer 401 step_up_required otherwise). Pass options to navigator.credentials.get() and send the answer to Finish a passkey confirmation.
For a person's own session (x-k8hq-token) only: assistants' delegated tokens and API tokens are refused.
Parameters
| Name | Type | Description |
x-amz-content-sha256 (header) required | string | The 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. |
{}
Response body (JSON)
| Field | Type | Description |
challengeId required | string | Send it back with the passkey's answer. Valid 5 minutes, once. Pattern: ^chl_. |
options required | object | Options for navigator.credentials.create() or .get(). The relying party is k8hq.com; user verification is required, and new passkeys are discoverable (signing in needs no username). |
Responses
| Status | Body | Meaning |
| 200 | Challenge | The ceremony's options. Pass options to the browser, then send its answer to the matching finish call within 5 minutes. |
| 401 | application/problem+json | No session, or it expired or was revoked (unauthenticated): refresh, or sign in again. |
| 403 | application/problem+json | Not allowed (forbidden): an assistant's delegated token, or a browser origin other than the web app's. |
| 500 | application/problem+json | A temporary problem (unavailable); retry. |
Finish a passkey confirmation
POST/v1/stepup/finish
Checks the passkey (it must be the same person's) and returns a new access token for the same session, confirmed now: for the next 5 minutes it passes recent-passkey checks here, in the Setup API and in the content API. The refresh token is unchanged.
For a person's own session (x-k8hq-token) only: assistants' delegated tokens and API tokens are refused.
Parameters
| Name | Type | Description |
x-amz-content-sha256 (header) required | string | The 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)
| Field | Type | Description |
challengeId required | string | |
credential required | object | The passkey's answer: the PublicKeyCredential from the browser as JSON (id, rawId, type, response with binary fields as base64url; PublicKeyCredential.toJSON() gives this shape). |
unlock | boolean | Ask for a release ticket (the step-up is to unlock the key with K8 HQ's copy). |
{"challengeId":"chl_01J...","credential":{"id":"...","response":{},"type":"public-key"}}
Response body (JSON)
| Field | Type | Description |
tokens required | Tokens | |
releaseTicket | string | For people with K8 HQ's copy of their key: a release ticket for Unlock with K8 HQ's copy, single use, valid 5 minutes, for this session only. |
Responses
| Status | Body | Meaning |
| 200 | JSON | A new access token (no refresh token). |
| 400 | application/problem+json | Malformed, or the challenge is unknown, expired or used, or the passkey's answer couldn't be read (invalid). |
| 401 | application/problem+json | No session or it expired (unauthenticated), or the passkey isn't recognized or isn't theirs. |
| 403 | application/problem+json | Not allowed (forbidden): an assistant's delegated token, or a browser origin other than the web app's. |
| 429 | application/problem+json | Too many failed passkey ceremonies from this address (rate_limited); wait 15 minutes. |
| 500 | application/problem+json | A temporary problem (unavailable); retry. |