Console API: auth
This page is generated from server/api/openapi.yaml. Do not edit it by hand.
Accounts, sessions, OAuth, TOTP, profile. Handlers: internal/console/auth.
GET /api/v1/auth/config
Section titled “GET /api/v1/auth/config”Sign-in page configuration
operationId authConfig · auth: public
| Status | Meaning | Body |
|---|---|---|
| 200 | OK | application/json AuthConfig |
| default | Error envelope. The HTTP status follows the error kind. | application/json Error |
Response 200 application/json — AuthConfig
registration_open(boolean, required)oauth_providers(array of OAuthProvider, required)captcha_site_key(string, required) — Turnstile site key; empty when the captcha is off.password_min_length(integer, required)
POST /api/v1/auth/register
Section titled “POST /api/v1/auth/register”Register with email and password
operationId authRegister · auth: public
Always answers 202, whether or not the address already has an account (no enumeration). Does not sign in: the user verifies the address, then logs in.
Request body (required) application/json — RegisterRequest
email(string, required)password(string, required, minLength: 10, maxLength: 128) — 10 to 128 characters.display_name(string)referral_code(string)captcha_token(string) — Cloudflare Turnstile response token.device_fingerprint(string) — Opaque device hash computed by the web app.locale(Locale) — User interface and email language. Supported: en (English, the default and fallback), es (Spanish), fr (French), zh (Chinese). On sign-up an omitted locale is taken from the Accept-Language header (best supported match by q-value), else en.
| Status | Meaning | Body |
|---|---|---|
| 202 | OK | application/json Accepted |
| default | Error envelope. The HTTP status follows the error kind. | application/json Error |
Response 202 application/json — Accepted
ok(boolean, required)
POST /api/v1/auth/login
Section titled “POST /api/v1/auth/login”Sign in with email and password
operationId authLogin · auth: public
On success sets the gw_session and gw_csrf cookies. Accounts with TOTP get status totp_required and no cookies.
Request body (required) application/json — LoginRequest
email(string, required)password(string, required)captcha_token(string)device_fingerprint(string)
| Status | Meaning | Body |
|---|---|---|
| 200 | OK | application/json LoginResponse |
| default | Error envelope. The HTTP status follows the error kind. | application/json Error |
Response 200 application/json — LoginResponse
status(“ok” | “totp_required”, required)session(SessionInfo) — The signed-in session: who, acting on which organisation.user(User, required) — A user account.id(string, required) email(string, required)email_verified(boolean, required)display_name(string, required)locale(Locale, required) — User interface and email language. Supported: en (English, the default and fallback), es (Spanish), fr (French), zh (Chinese). On sign-up an omitted locale is taken from the Accept-Language header (best supported match by q-value), else en.status(UserStatus, required)is_admin(boolean, required) — Platform operator.totp_enabled(boolean, required)has_password(boolean, required) — False for OAuth-only accounts.oauth_providers(array of OAuthProvider, required)default_org_id(string, required, nullable) last_login_at(string, required, nullable) created_at(string, required)
org(Org, required) — An organisation: the billing subject. A personal account is an org of kindpersonal.id(string, required) name(string, required)kind(OrgKind, required)status(OrgStatus, required)frozen_reason(FreezeReason, required) — Empty when the organisation is not frozen.owner_user_id(string, required) trust_tier(integer, required) discount_ppm(integer, required) — Fraction taken off list prices, in ppm (0 = no discount). created_at(string, required)
role(OrgRole, required)permissions(array of string, required) — Permissions the role grants in the active organisation: view_usage, manage_own_keys, manage_all_keys, view_billing, manage_billing, manage_members, manage_org, owner.is_admin(boolean, required)totp_verified(boolean, required) — This session passed the second factor. The admin API needs is_admin and totp_verified.csrf_token(string, required) — Echo in the X-CSRF-Token header of every state-changing request (also set as the gw_csrf cookie).expires_at(string, required)
totp_challenge(string) — Present when status is totp_required; valid five minutes.
POST /api/v1/auth/login/totp
Section titled “POST /api/v1/auth/login/totp”Finish a sign-in with a TOTP or recovery code
operationId authLoginTotp · auth: public
Request body (required) application/json — TotpLoginRequest
challenge(string, required)code(string, required) — TOTP code or a recovery code.
| Status | Meaning | Body |
|---|---|---|
| 200 | OK | application/json SessionInfo |
| default | Error envelope. The HTTP status follows the error kind. | application/json Error |
Response 200 application/json — SessionInfo
user(User, required) — A user account.id(string, required) email(string, required)email_verified(boolean, required)display_name(string, required)locale(Locale, required) — User interface and email language. Supported: en (English, the default and fallback), es (Spanish), fr (French), zh (Chinese). On sign-up an omitted locale is taken from the Accept-Language header (best supported match by q-value), else en.status(UserStatus, required)is_admin(boolean, required) — Platform operator.totp_enabled(boolean, required)has_password(boolean, required) — False for OAuth-only accounts.oauth_providers(array of OAuthProvider, required)default_org_id(string, required, nullable) last_login_at(string, required, nullable) created_at(string, required)
org(Org, required) — An organisation: the billing subject. A personal account is an org of kindpersonal.id(string, required) name(string, required)kind(OrgKind, required)status(OrgStatus, required)frozen_reason(FreezeReason, required) — Empty when the organisation is not frozen.owner_user_id(string, required) trust_tier(integer, required) discount_ppm(integer, required) — Fraction taken off list prices, in ppm (0 = no discount). created_at(string, required)
role(OrgRole, required)permissions(array of string, required) — Permissions the role grants in the active organisation: view_usage, manage_own_keys, manage_all_keys, view_billing, manage_billing, manage_members, manage_org, owner.is_admin(boolean, required)totp_verified(boolean, required) — This session passed the second factor. The admin API needs is_admin and totp_verified.csrf_token(string, required) — Echo in the X-CSRF-Token header of every state-changing request (also set as the gw_csrf cookie).expires_at(string, required)
POST /api/v1/auth/logout
Section titled “POST /api/v1/auth/logout”Sign out and clear the cookies
operationId authLogout · auth: session
| Status | Meaning | Body |
|---|---|---|
| 204 | Done. | — |
| default | Error envelope. The HTTP status follows the error kind. | application/json Error |
GET /api/v1/auth/session
Section titled “GET /api/v1/auth/session”The current session (me)
operationId authSession · auth: session
Answers 401 session_invalid when not signed in; the web app uses that as its auth probe. When the user no longer belongs to the session’s active organisation (removed, or the team was closed), the session is moved to the user’s personal organisation first; 404 not_a_member only when there is none.
| Status | Meaning | Body |
|---|---|---|
| 200 | OK | application/json SessionInfo |
| default | Error envelope. The HTTP status follows the error kind. | application/json Error |
Response 200 application/json — SessionInfo
user(User, required) — A user account.id(string, required) email(string, required)email_verified(boolean, required)display_name(string, required)locale(Locale, required) — User interface and email language. Supported: en (English, the default and fallback), es (Spanish), fr (French), zh (Chinese). On sign-up an omitted locale is taken from the Accept-Language header (best supported match by q-value), else en.status(UserStatus, required)is_admin(boolean, required) — Platform operator.totp_enabled(boolean, required)has_password(boolean, required) — False for OAuth-only accounts.oauth_providers(array of OAuthProvider, required)default_org_id(string, required, nullable) last_login_at(string, required, nullable) created_at(string, required)
org(Org, required) — An organisation: the billing subject. A personal account is an org of kindpersonal.id(string, required) name(string, required)kind(OrgKind, required)status(OrgStatus, required)frozen_reason(FreezeReason, required) — Empty when the organisation is not frozen.owner_user_id(string, required) trust_tier(integer, required) discount_ppm(integer, required) — Fraction taken off list prices, in ppm (0 = no discount). created_at(string, required)
role(OrgRole, required)permissions(array of string, required) — Permissions the role grants in the active organisation: view_usage, manage_own_keys, manage_all_keys, view_billing, manage_billing, manage_members, manage_org, owner.is_admin(boolean, required)totp_verified(boolean, required) — This session passed the second factor. The admin API needs is_admin and totp_verified.csrf_token(string, required) — Echo in the X-CSRF-Token header of every state-changing request (also set as the gw_csrf cookie).expires_at(string, required)
POST /api/v1/auth/email/verify
Section titled “POST /api/v1/auth/email/verify”Verify an email address with the mailed token
operationId authVerifyEmail · auth: public
Request body (required) application/json — TokenRequest
token(string, required)
| Status | Meaning | Body |
|---|---|---|
| 200 | OK | application/json User |
| default | Error envelope. The HTTP status follows the error kind. | application/json Error |
Response 200 application/json — User
id(string, required) email(string, required)email_verified(boolean, required)display_name(string, required)locale(Locale, required) — User interface and email language. Supported: en (English, the default and fallback), es (Spanish), fr (French), zh (Chinese). On sign-up an omitted locale is taken from the Accept-Language header (best supported match by q-value), else en.status(UserStatus, required)is_admin(boolean, required) — Platform operator.totp_enabled(boolean, required)has_password(boolean, required) — False for OAuth-only accounts.oauth_providers(array of OAuthProvider, required)default_org_id(string, required, nullable) last_login_at(string, required, nullable) created_at(string, required)
POST /api/v1/auth/email/resend
Section titled “POST /api/v1/auth/email/resend”Send the verification mail again
operationId authResendVerification · auth: session
| Status | Meaning | Body |
|---|---|---|
| 202 | OK | application/json Accepted |
| default | Error envelope. The HTTP status follows the error kind. | application/json Error |
Response 202 application/json — Accepted
ok(boolean, required)
POST /api/v1/auth/password/forgot
Section titled “POST /api/v1/auth/password/forgot”Request a password reset link
operationId authForgotPassword · auth: public
Always answers 202.
Request body (required) application/json — ForgotPasswordRequest
email(string, required)captcha_token(string)
| Status | Meaning | Body |
|---|---|---|
| 202 | OK | application/json Accepted |
| default | Error envelope. The HTTP status follows the error kind. | application/json Error |
Response 202 application/json — Accepted
ok(boolean, required)
POST /api/v1/auth/password/reset
Section titled “POST /api/v1/auth/password/reset”Set a new password from a reset token
operationId authResetPassword · auth: public
Revokes every session of the user.
Request body (required) application/json — ResetPasswordRequest
token(string, required)new_password(string, required, minLength: 10, maxLength: 128)
| Status | Meaning | Body |
|---|---|---|
| 204 | Done. | — |
| default | Error envelope. The HTTP status follows the error kind. | application/json Error |
POST /api/v1/auth/password/change
Section titled “POST /api/v1/auth/password/change”Change the password
operationId authChangePassword · auth: session
Revokes the user’s other sessions. Accounts without a password (OAuth-only) get 422 password_not_set; they set one through the password reset email (POST /api/v1/auth/password/forgot).
Request body (required) application/json — ChangePasswordRequest
current_password(string) — Required unless the account has no password yet.new_password(string, required, minLength: 10, maxLength: 128)
| Status | Meaning | Body |
|---|---|---|
| 204 | Done. | — |
| default | Error envelope. The HTTP status follows the error kind. | application/json Error |
GET /api/v1/auth/oauth/{provider}/start
Section titled “GET /api/v1/auth/oauth/{provider}/start”Begin an OAuth sign-in
operationId authOAuthStart · auth: public
Returns the provider’s authorisation URL; the web app navigates the browser to it. Also sets the short-lived HttpOnly gw_oauth cookie (Path /api/v1/auth/oauth) that binds the flow to this browser, so the web app must call it with credentials.
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
provider |
path | OAuthProvider | yes | |
return_to |
query | string | no | Path of the web app to land on afterwards. |
referral_code |
query | string | no |
| Status | Meaning | Body |
|---|---|---|
| 200 | OK | application/json Link |
| default | Error envelope. The HTTP status follows the error kind. | application/json Error |
Response 200 application/json — Link
url(string, required)
GET /api/v1/auth/oauth/{provider}/callback
Section titled “GET /api/v1/auth/oauth/{provider}/callback”OAuth provider callback
operationId authOAuthCallback · auth: public
Called by the browser on return from the provider, not by the web app.
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
provider |
path | OAuthProvider | yes | |
code |
query | string | no | |
state |
query | string | no | |
error |
query | string | no |
| Status | Meaning | Body |
|---|---|---|
| 302 | Redirect to the web app. On success the session cookies are set; for an account with TOTP enabled no session is set and the location is /login?redirect=<path>#totp=<challenge> (finish with authLoginTotp); on failure the location carries ?error=<code>. The request must carry the gw_oauth cookie set by authOAuthStart in the same browser (login CSRF protection); it is cleared on every outcome. |
— |
| default | Error envelope. The HTTP status follows the error kind. | application/json Error |
POST /api/v1/auth/totp/enroll
Section titled “POST /api/v1/auth/totp/enroll”Start TOTP enrolment
operationId authTotpEnroll · auth: session
| Status | Meaning | Body |
|---|---|---|
| 200 | OK | application/json TotpEnrollment |
| default | Error envelope. The HTTP status follows the error kind. | application/json Error |
Response 200 application/json — TotpEnrollment
secret(string, required)otpauth_url(string, required) — otpauth:// URI to render as a QR code.
POST /api/v1/auth/totp/verify
Section titled “POST /api/v1/auth/totp/verify”Confirm TOTP enrolment with a code
operationId authTotpVerify · auth: session
Activates TOTP and returns the recovery codes once. Marks this session as verified, except for operators, who sign in again with a code or use step-up.
Request body (required) application/json — TotpCodeRequest
code(string, required)
| Status | Meaning | Body |
|---|---|---|
| 200 | OK | application/json TotpRecoveryCodes |
| default | Error envelope. The HTTP status follows the error kind. | application/json Error |
Response 200 application/json — TotpRecoveryCodes
recovery_codes(array of string, required)
POST /api/v1/auth/totp/step-up
Section titled “POST /api/v1/auth/totp/step-up”Pass the second factor for the current session
operationId authTotpStepUp · auth: session
For a signed-in user with TOTP enabled whose session has not passed it yet (every OAuth sign-in, and sessions opened before enrolment). Accepts a TOTP or an unused recovery code (consumed) and marks the session totp_verified; an already verified session is returned unchanged. The web app calls it when the admin API answers 403 totp_required. Errors 401 totp_invalid, 422 totp_not_enabled (enrol first), 429 after repeated failures.
Request body (required) application/json — TotpCodeRequest
code(string, required)
| Status | Meaning | Body |
|---|---|---|
| 200 | OK | application/json SessionInfo |
| default | Error envelope. The HTTP status follows the error kind. | application/json Error |
Response 200 application/json — SessionInfo
user(User, required) — A user account.id(string, required) email(string, required)email_verified(boolean, required)display_name(string, required)locale(Locale, required) — User interface and email language. Supported: en (English, the default and fallback), es (Spanish), fr (French), zh (Chinese). On sign-up an omitted locale is taken from the Accept-Language header (best supported match by q-value), else en.status(UserStatus, required)is_admin(boolean, required) — Platform operator.totp_enabled(boolean, required)has_password(boolean, required) — False for OAuth-only accounts.oauth_providers(array of OAuthProvider, required)default_org_id(string, required, nullable) last_login_at(string, required, nullable) created_at(string, required)
org(Org, required) — An organisation: the billing subject. A personal account is an org of kindpersonal.id(string, required) name(string, required)kind(OrgKind, required)status(OrgStatus, required)frozen_reason(FreezeReason, required) — Empty when the organisation is not frozen.owner_user_id(string, required) trust_tier(integer, required) discount_ppm(integer, required) — Fraction taken off list prices, in ppm (0 = no discount). created_at(string, required)
role(OrgRole, required)permissions(array of string, required) — Permissions the role grants in the active organisation: view_usage, manage_own_keys, manage_all_keys, view_billing, manage_billing, manage_members, manage_org, owner.is_admin(boolean, required)totp_verified(boolean, required) — This session passed the second factor. The admin API needs is_admin and totp_verified.csrf_token(string, required) — Echo in the X-CSRF-Token header of every state-changing request (also set as the gw_csrf cookie).expires_at(string, required)
POST /api/v1/auth/totp/disable
Section titled “POST /api/v1/auth/totp/disable”Turn TOTP off
operationId authTotpDisable · auth: session
Not allowed for platform operators.
Request body (required) application/json — TotpCodeRequest
code(string, required)
| Status | Meaning | Body |
|---|---|---|
| 204 | Done. | — |
| default | Error envelope. The HTTP status follows the error kind. | application/json Error |
GET /api/v1/auth/sessions
Section titled “GET /api/v1/auth/sessions”List the user’s sessions
operationId authListSessions · auth: session
| Status | Meaning | Body |
|---|---|---|
| 200 | OK | application/json SessionEntryList |
| default | Error envelope. The HTTP status follows the error kind. | application/json Error |
Response 200 application/json — SessionEntryList
data(array of SessionEntry, required)id(string, required)current(boolean, required)ip(string, required)user_agent(string, required)created_at(string, required) expires_at(string, required)
DELETE /api/v1/auth/sessions/{session_id}
Section titled “DELETE /api/v1/auth/sessions/{session_id}”Revoke one session
operationId authRevokeSession · auth: session
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
session_id |
path | string | yes |
| Status | Meaning | Body |
|---|---|---|
| 204 | Done. | — |
| default | Error envelope. The HTTP status follows the error kind. | application/json Error |
POST /api/v1/auth/sessions/revoke-others
Section titled “POST /api/v1/auth/sessions/revoke-others”Revoke every session except the current one
operationId authRevokeOtherSessions · auth: session
| Status | Meaning | Body |
|---|---|---|
| 204 | Done. | — |
| default | Error envelope. The HTTP status follows the error kind. | application/json Error |
PATCH /api/v1/account
Section titled “PATCH /api/v1/account”Update the profile
operationId accountUpdate · auth: session
Request body (required) application/json — UpdateProfileRequest
display_name(string)locale(Locale) — User interface and email language. Supported: en (English, the default and fallback), es (Spanish), fr (French), zh (Chinese). On sign-up an omitted locale is taken from the Accept-Language header (best supported match by q-value), else en.
| Status | Meaning | Body |
|---|---|---|
| 200 | OK | application/json User |
| default | Error envelope. The HTTP status follows the error kind. | application/json Error |
Response 200 application/json — User
id(string, required) email(string, required)email_verified(boolean, required)display_name(string, required)locale(Locale, required) — User interface and email language. Supported: en (English, the default and fallback), es (Spanish), fr (French), zh (Chinese). On sign-up an omitted locale is taken from the Accept-Language header (best supported match by q-value), else en.status(UserStatus, required)is_admin(boolean, required) — Platform operator.totp_enabled(boolean, required)has_password(boolean, required) — False for OAuth-only accounts.oauth_providers(array of OAuthProvider, required)default_org_id(string, required, nullable) last_login_at(string, required, nullable) created_at(string, required)
GET /api/v1/account/notification-preferences
Section titled “GET /api/v1/account/notification-preferences”Read notification preferences
operationId accountGetNotificationPreferences · auth: session
| Status | Meaning | Body |
|---|---|---|
| 200 | OK | application/json NotificationPreferences |
| default | Error envelope. The HTTP status follows the error kind. | application/json Error |
Response 200 application/json — NotificationPreferences
low_balance(boolean, required)topup_credited(boolean, required)subscription_renewed(boolean, required)product_updates(boolean, required)
PUT /api/v1/account/notification-preferences
Section titled “PUT /api/v1/account/notification-preferences”Replace notification preferences
operationId accountSetNotificationPreferences · auth: session
Request body (required) application/json — NotificationPreferences
low_balance(boolean, required)topup_credited(boolean, required)subscription_renewed(boolean, required)product_updates(boolean, required)
| Status | Meaning | Body |
|---|---|---|
| 200 | OK | application/json NotificationPreferences |
| default | Error envelope. The HTTP status follows the error kind. | application/json Error |
Response 200 application/json — NotificationPreferences
low_balance(boolean, required)topup_credited(boolean, required)subscription_renewed(boolean, required)product_updates(boolean, required)
GET /api/v1/account/export
Section titled “GET /api/v1/account/export”Export my personal data
operationId accountExport · auth: session
Everything the platform stores about the signed-in user, as one JSON document: profile, linked sign-in
providers, organisation memberships, API keys (name, prefix, status, dates; never the secret), and for the
personal organisation its balance, payment orders, credit grants and the usage of the last 90 days (at most
10,000 records; usage.truncated says when more exist; the CSV usage export has the full history). Money is
nano-USD strings as everywhere. The document has format_version 1.
| Status | Meaning | Body |
|---|---|---|
| 200 | OK | application/json PersonalDataExport |
| default | Error envelope. The HTTP status follows the error kind. | application/json Error |
Response 200 application/json — PersonalDataExport
Personal data export, format_version 1. Sections: format_version, generated_at, user, oauth, memberships, api_keys, personal_org (org, payment_orders, credit_grants, usage). The shape of each section follows the matching console API objects; money is nano-USD strings.
POST /api/v1/account/deletion
Section titled “POST /api/v1/account/deletion”Delete my account
operationId accountDelete · auth: session
Closes the account at once (every session and API key stops working, the personal organisation is closed) and
erases the personal data after the grace period of the retention.account_erase_grace_days setting. Ledger
entries, payment records and the audit trail are kept without the personal data, as bookkeeping requires.
Refused with 422 and a specific code while something is still open: erasure_outstanding_debt (unpaid
debt), erasure_open_dispute (a chargeback in progress), erasure_payment_pending (an unfinished payment or
refund), erasure_live_subscription (cancel it first), erasure_owns_team_org (transfer or close it first),
erasure_operator (operators are demoted first), erasure_balance_remaining (credits or affiliate
commission left: repeat with forfeit_balance: true to give them up; nothing is refunded automatically).
An account with TOTP needs a session that passed TOTP (403 totp_required). confirm_email must equal the
account’s address (400 erasure_confirmation_mismatch).
Request body (required) application/json — AccountDeletionRequest
confirm_email(string, required) — The account’s email address, typed again.forfeit_balance(boolean, default: false) — Give up remaining credits and affiliate commission.
| Status | Meaning | Body |
|---|---|---|
| 202 | Accepted. The account is closed; personal data is erased at erase_after. |
application/json Erasure |
| default | Error envelope. The HTTP status follows the error kind. | application/json Error |
Response 202 application/json — Erasure
id(string, required) subject_type(“user” | “org”, required)subject_id(string, required) status(ErasureStatus, required)requested_via(“self” | “admin”, required)requested_by(string, required, nullable) forfeit_nano(NanoUSD, required, pattern: ”^-?[0-9]+$”) — An amount of money in nano-USD (1 USD = 1,000,000,000) as a decimal integer string. It is a string because an int64 does not survive JavaScript numbers. Never a float.erase_after(string, required) attempts(integer, required) last_error(string, required) — Code of the condition that postponed the last pass (” when none).created_at(string, required) done_at(string, required, nullable)