Auth Endpoints schema — API Protocol reference
Defines the canonical HTTP endpoints for the authentication service. Based on better-auth v1.4.18 endpoint conventions.
Authentication Endpoint Specification
Defines the canonical HTTP endpoints for the authentication service. Based on better-auth v1.4.18 endpoint conventions.
NOTE: ObjectStack's auth implementation uses better-auth library which has established endpoint conventions. This spec documents those conventions as the canonical API contract.
Source: packages/spec/src/api/auth-endpoints.zod.ts
TypeScript Usage
import { AuthEndpointSchema, AuthFeaturesConfigSchema, AuthProviderInfoSchema, DeviceRequestResponseSchema, DeviceTokenResponseSchema, EmailPasswordConfigPublicSchema, GetAuthConfigResponseSchema, OneTimeTokenHandoffQuerySchema, OneTimeTokenVerifyRequestSchema, OneTimeTokenVerifyResponseSchema, OrganizationEditionChoiceSchema } from '@objectstack/spec/api';
import type { AuthEndpoint, AuthFeaturesConfig, AuthProviderInfo, DeviceRequestResponse, DeviceTokenResponse, EmailPasswordConfigPublic, GetAuthConfigResponse, OneTimeTokenHandoffQuery, OneTimeTokenVerifyRequest, OneTimeTokenVerifyResponse, OrganizationEditionChoice } from '@objectstack/spec/api';
// Validate data
const result = AuthEndpointSchema.parse(data);AuthEndpoint
Properties
| Property | Type | Required | Description |
|---|---|---|---|
| signInEmail | { method: 'POST'; path: '/sign-in/email'; description: 'Sign in with email and password' } | ✅ | |
| signUpEmail | { method: 'POST'; path: '/sign-up/email'; description: 'Register new user with email and password' } | ✅ | |
| signOut | { method: 'POST'; path: '/sign-out'; description: 'Sign out current user' } | ✅ | |
| getSession | { method: 'GET'; path: '/get-session'; description: 'Get current user session' } | ✅ | |
| forgetPassword | { method: 'POST'; path: '/forget-password'; description: 'Request password reset email' } | ✅ | |
| resetPassword | { method: 'POST'; path: '/reset-password'; description: 'Reset password with token' } | ✅ | |
| sendVerificationEmail | { method: 'POST'; path: '/send-verification-email'; description: 'Send email verification link' } | ✅ | |
| verifyEmail | { method: 'GET'; path: '/verify-email'; description: 'Verify email with token' } | ✅ |
AuthFeaturesConfig
Properties
| Property | Type | Required | Description |
|---|---|---|---|
| twoFactor | boolean | optional (default: false) | Two-factor authentication enabled |
| passkeys | never | optional | [REMOVED] features.passkeys was removed from GET /api/v1/auth/config in @objectstack/spec 17 (ADR-0049) — it was served from introduction and consumed by nothing: no login UI in any client reads it, and no better-auth passkey plugin is wired behind it, so a deployer who set plugins.passkeys: true flipped a switch that changed no behaviour anywhere. Delete the key. There is no replacement flag to read: passkey sign-in is not a capability this platform offers yet. It returns to this payload in the change that ships the login UI, classified in PUBLIC_AUTH_FEATURES again at that point — do not re-add it ahead of a consumer. |
| magicLink | never | optional | [REMOVED] features.magicLink was removed from GET /api/v1/auth/config in @objectstack/spec 17 (ADR-0049) — the ADVERTISEMENT was inert, not the capability: no client renders a magic-link sign-in affordance off this flag, so it only told a deployer that a UI existed when none did. Delete the key. The server side is unchanged and still yours to call: AuthPluginConfig.plugins.magicLink wires better-auth's magic-link plugin, and /api/v1/auth/magic-link/send + /magic-link/verify answer exactly as before — drive them from your own UI, or wait for the console release that restores this flag along with the login UI that reads it. |
| organization | boolean | optional (default: false) | Multi-tenant organization support enabled |
| sso | boolean | optional | Enterprise SSO sign-in usable: the domain-routed SSO plugin is wired AND at least one SSO provider is configured, so the login UI offers its "Sign in with SSO" entry; false when SSO is off, or on with no provider yet. The served value is that usable answer (isSsoUsable), not the coarse wired flag: GET /auth/config refines it before answering, and falls open to the wired flag when providers cannot be counted. Unlike ssoEnforced, which takes the password form away, this only says whether the SSO entry exists; absent means not usable |
| ssoEnforced | boolean | optional | SSO-only login enforced: the UI hides the local password form + self-registration (a break-glass "use a password" link remains) |
| phoneNumber | boolean | optional | Phone-number sign-in enabled (phone + password, V1.5) |
| phoneNumberOtp | boolean | optional | Phone-number OTP sign-in and self-service password reset available — requires the phoneNumber plugin plus a deliverable SMS service |
| emailDelivery | boolean | optional | Email leaves this deployment: the wired email service reports itself configured with a real transport, so password-reset, verification and invitation mail is delivered. False with no email service and with the stock log transport, which writes mail to the server console instead of sending it; the forgot-password page can then say a reset link cannot be emailed here and to ask an administrator. A statement about the deployment, never about an address: the password-reset request answers known and unknown addresses alike either way. Absent means not live |
| cloudManaged | boolean | optional | Managed (cloud-hosted, SSO-only) mode: people arrive through the identity provider, so the UI hides inviting, creating users and setting their passwords; absent means not managed |
| developerEditionCreate | boolean | optional | Developer Edition organizations can be created here: true exactly when organizationEditions holds a choice whose edition is developer, i.e. the host's organization-create door accepts ?edition=developer. The same fact as a boolean, so an action, param or field group can gate on it with requiresFeature; the choice's words and cap live in organizationEditions. An advertisement of the host's door, not a switch: it changes no server behaviour. Absent or false means no developer choice is offered |
| organizationEditions | { edition: string; label: string; hint: string; memberLimit?: integer }[] | optional | Editions the host's organization-create door accepts besides its default, each with the edition query value, a label and a hint the host resolved in the request language, and its member cap when one applies. Each edition value appears once, so a picked choice names one door value. The create-organization form draws each as a choice that starts unchecked (the renderer's rule: no choice is ever picked for the user) and, when one is picked, sends its edition value to the create door. Served only when the host declares choices; absent means the door takes no edition and the form offers none |
| turnstileSiteKey | string | optional | Public Cloudflare Turnstile site key, present only while the opt-in sign-up challenge is on: the sign-up form renders the widget and sends its token in the x-captcha-response header; absent means no challenge |
| multiOrgEnabled | boolean | optional | Multi-organization capability: true when the effective tenancy posture enforces an organization wall (group or isolated), the same answer the create-organization door gives; false on a single posture, and on a degraded deployment that asked for isolation but has none. The console offers creating, switching and leaving organizations only when it is on; the flag is default-on, so absent reads as on |
| tenancyPosture | Enum<'single' | 'group' | 'isolated'> | optional | Which tenancy posture is in force (single, group or isolated): the effective posture, from the same derivation as multiOrgEnabled. A value, not a gate: multiOrgEnabled stays the capability flag, while this tells the console how to render organization context (under group the organization switcher picks the write target and reads span every organization the member belongs to) |
| audiencePosture | Enum<'invite_only' | 'email_domain' | 'open'> | optional | Who may self-register into this environment (invite_only, email_domain or open): the posture the sign-up path enforces, reported as invite_only when the configured value is off-vocabulary. A value, not a gate: emailPassword.disableSignUp stays the boolean that hides the sign-up form, while this lets the login page say that registration is by invitation instead of offering a form the server refuses |
| degradedTenancy | boolean | optional | Degraded tenancy: true when multi-organization isolation was requested but is not active (the deployment booted only because OS_ALLOW_DEGRADED_TENANCY=1), so no engine enforces organization boundaries; the console can raise an operator warning off it. A status signal, not a capability gate; absent means not degraded |
| oidcProvider | boolean | optional | Embedded OIDC authorization server wired, from the same decision that mounts it, so OAuth applications can be registered and managed; on by default alongside the MCP surface. It says nothing about sign-in providers, which socialProviders lists; the flag is default-on, so absent reads as on |
| deviceAuthorization | boolean | optional | Device authorization (browser-approved CLI login) wired, so the device-code endpoints answer; when false the console device-approval page says device authorization is not enabled instead of calling them. Absent means not wired |
| admin | boolean | optional | Admin plugin wired (forced on whenever SCIM is enabled), so user administration (creating, banning, unlocking and impersonating users, setting their passwords) is available; the console shows those actions only when it is true. Absent means not wired |
| termsUrl | string | optional | Terms-of-service link shown beneath the login and register cards: the trimmed OS_TERMS_URL value when set, otherwise the public ObjectStack terms page; absent when the operator set OS_TERMS_URL to an empty or blank (whitespace-only) value to suppress the link |
| privacyUrl | string | optional | Privacy-policy link shown beneath the login and register cards: the trimmed OS_PRIVACY_URL value when set, otherwise the public ObjectStack privacy page; absent when the operator set OS_PRIVACY_URL to an empty or blank (whitespace-only) value to suppress the link |
Nested Shape: AuthFeaturesConfig.organizationEditions[number]
| Property | Type | Required | Description |
|---|---|---|---|
| edition | string | ✅ | The value the organization-create door takes in its edition query parameter for this choice (snake_case, e.g. developer); the client sends it back unchanged when the choice is picked |
| label | string | ✅ | Display name of the choice, already resolved by the host in the language the request asked for; the form shows it as given |
| hint | string | ✅ | One line under the label saying what the choice means, already resolved by the host in the request language; the form shows it as given |
| memberLimit | integer | optional | Most members an organization of this edition may hold, when the edition caps them; the host's own figure, so a form that mentions the cap never spells a constant of its own. Absent means no cap is stated |
AuthProviderInfo
Properties
| Property | Type | Required | Description |
|---|---|---|---|
| id | string | ✅ | Provider ID (e.g., google, github, microsoft, okta) |
| name | string | ✅ | Display name (e.g., Google, GitHub) |
| enabled | boolean | ✅ | Whether this provider is enabled |
| type | Enum<'social' | 'oidc'> | optional (default: "social") | Provider type |
DeviceRequestResponse
Properties
| Property | Type | Required | Description |
|---|---|---|---|
| code | string | ✅ | Short-lived device code used for polling |
| verificationUrl | string | ✅ | URL the user should open in a browser |
| expiresAt | string | ✅ | ISO timestamp when the code expires |
| intervalSeconds | number | optional (default: 2) | Recommended polling interval in seconds |
| interval | never | optional | [REMOVED] DeviceRequestResponse.interval was renamed to intervalSeconds in @objectstack/spec 17 — the polling cadence is a duration and its unit lived only in the describe prose. Rename the key to intervalSeconds; the value (seconds) is unchanged. This response is not an RFC 8628 device-authorization payload — it renames every RFC field it carries — so the standard does not fix the bare spelling here. |
DeviceTokenResponse
Union Options
This schema accepts one of the following structures:
Option 1
Properties
| Property | Type | Required | Description |
|---|---|---|---|
| status | 'pending' | ✅ |
Option 2
Properties
| Property | Type | Required | Description |
|---|---|---|---|
| status | 'approved' | ✅ | |
| token | string | ✅ | Bearer token to store in credentials file |
| user | { id: string; email: string; name?: string } | ✅ |
Option 3
Properties
| Property | Type | Required | Description |
|---|---|---|---|
| status | 'expired' | ✅ |
EmailPasswordConfigPublic
Properties
| Property | Type | Required | Description |
|---|---|---|---|
| enabled | boolean | ✅ | Whether email/password auth is enabled |
| disableSignUp | boolean | optional | Whether new user registration is disabled |
| requireEmailVerification | boolean | optional | Whether email verification is required |
GetAuthConfigResponse
Properties
| Property | Type | Required | Description |
|---|---|---|---|
| emailPassword | { enabled: boolean; disableSignUp?: boolean; requireEmailVerification?: boolean } | ✅ | Email/password authentication config |
| socialProviders | { id: string; name: string; enabled: boolean; type?: Enum<'social' | 'oidc'> }[] | ✅ | Available social/OAuth providers |
| features | { twoFactor?: boolean; organization?: boolean; sso?: boolean; ssoEnforced?: boolean; … } | ✅ | Enabled authentication features |
Nested Shape: GetAuthConfigResponse.emailPassword
| Property | Type | Required | Description |
|---|---|---|---|
| enabled | boolean | ✅ | Whether email/password auth is enabled |
| disableSignUp | boolean | optional | Whether new user registration is disabled |
| requireEmailVerification | boolean | optional | Whether email verification is required |
Nested Shape: GetAuthConfigResponse.socialProviders[number]
| Property | Type | Required | Description |
|---|---|---|---|
| id | string | ✅ | Provider ID (e.g., google, github, microsoft, okta) |
| name | string | ✅ | Display name (e.g., Google, GitHub) |
| enabled | boolean | ✅ | Whether this provider is enabled |
| type | Enum<'social' | 'oidc'> | optional (default: "social") | Provider type |
Nested Shape: GetAuthConfigResponse.features
| Property | Type | Required | Description |
|---|---|---|---|
| twoFactor | boolean | optional (default: false) | Two-factor authentication enabled |
| passkeys | never | optional | [REMOVED] features.passkeys was removed from GET /api/v1/auth/config in @objectstack/spec 17 (ADR-0049) — it was served from introduction and consumed by nothing: no login UI in any client reads it, and no better-auth passkey plugin is wired behind it, so a deployer who set plugins.passkeys: true flipped a switch that changed no behaviour anywhere. Delete the key. There is no replacement flag to read: passkey sign-in is not a capability this platform offers yet. It returns to this payload in the change that ships the login UI, classified in PUBLIC_AUTH_FEATURES again at that point — do not re-add it ahead of a consumer. |
| magicLink | never | optional | [REMOVED] features.magicLink was removed from GET /api/v1/auth/config in @objectstack/spec 17 (ADR-0049) — the ADVERTISEMENT was inert, not the capability: no client renders a magic-link sign-in affordance off this flag, so it only told a deployer that a UI existed when none did. Delete the key. The server side is unchanged and still yours to call: AuthPluginConfig.plugins.magicLink wires better-auth's magic-link plugin, and /api/v1/auth/magic-link/send + /magic-link/verify answer exactly as before — drive them from your own UI, or wait for the console release that restores this flag along with the login UI that reads it. |
| organization | boolean | optional (default: false) | Multi-tenant organization support enabled |
| sso | boolean | optional | Enterprise SSO sign-in usable: the domain-routed SSO plugin is wired AND at least one SSO provider is configured, so the login UI offers its "Sign in with SSO" entry; false when SSO is off, or on with no provider yet. The served value is that usable answer (isSsoUsable), not the coarse wired flag: GET /auth/config refines it before answering, and falls open to the wired flag when providers cannot be counted. Unlike ssoEnforced, which takes the password form away, this only says whether the SSO entry exists; absent means not usable |
| ssoEnforced | boolean | optional | SSO-only login enforced: the UI hides the local password form + self-registration (a break-glass "use a password" link remains) |
| phoneNumber | boolean | optional | Phone-number sign-in enabled (phone + password, V1.5) |
| phoneNumberOtp | boolean | optional | Phone-number OTP sign-in and self-service password reset available — requires the phoneNumber plugin plus a deliverable SMS service |
| emailDelivery | boolean | optional | Email leaves this deployment: the wired email service reports itself configured with a real transport, so password-reset, verification and invitation mail is delivered. False with no email service and with the stock log transport, which writes mail to the server console instead of sending it; the forgot-password page can then say a reset link cannot be emailed here and to ask an administrator. A statement about the deployment, never about an address: the password-reset request answers known and unknown addresses alike either way. Absent means not live |
| cloudManaged | boolean | optional | Managed (cloud-hosted, SSO-only) mode: people arrive through the identity provider, so the UI hides inviting, creating users and setting their passwords; absent means not managed |
| developerEditionCreate | boolean | optional | Developer Edition organizations can be created here: true exactly when organizationEditions holds a choice whose edition is developer, i.e. the host's organization-create door accepts ?edition=developer. The same fact as a boolean, so an action, param or field group can gate on it with requiresFeature; the choice's words and cap live in organizationEditions. An advertisement of the host's door, not a switch: it changes no server behaviour. Absent or false means no developer choice is offered |
| organizationEditions | { edition: string; label: string; hint: string; memberLimit?: integer }[] | optional | Editions the host's organization-create door accepts besides its default, each with the edition query value, a label and a hint the host resolved in the request language, and its member cap when one applies. Each edition value appears once, so a picked choice names one door value. The create-organization form draws each as a choice that starts unchecked (the renderer's rule: no choice is ever picked for the user) and, when one is picked, sends its edition value to the create door. Served only when the host declares choices; absent means the door takes no edition and the form offers none |
| turnstileSiteKey | string | optional | Public Cloudflare Turnstile site key, present only while the opt-in sign-up challenge is on: the sign-up form renders the widget and sends its token in the x-captcha-response header; absent means no challenge |
| multiOrgEnabled | boolean | optional | Multi-organization capability: true when the effective tenancy posture enforces an organization wall (group or isolated), the same answer the create-organization door gives; false on a single posture, and on a degraded deployment that asked for isolation but has none. The console offers creating, switching and leaving organizations only when it is on; the flag is default-on, so absent reads as on |
| tenancyPosture | Enum<'single' | 'group' | 'isolated'> | optional | Which tenancy posture is in force (single, group or isolated): the effective posture, from the same derivation as multiOrgEnabled. A value, not a gate: multiOrgEnabled stays the capability flag, while this tells the console how to render organization context (under group the organization switcher picks the write target and reads span every organization the member belongs to) |
| audiencePosture | Enum<'invite_only' | 'email_domain' | 'open'> | optional | Who may self-register into this environment (invite_only, email_domain or open): the posture the sign-up path enforces, reported as invite_only when the configured value is off-vocabulary. A value, not a gate: emailPassword.disableSignUp stays the boolean that hides the sign-up form, while this lets the login page say that registration is by invitation instead of offering a form the server refuses |
| degradedTenancy | boolean | optional | Degraded tenancy: true when multi-organization isolation was requested but is not active (the deployment booted only because OS_ALLOW_DEGRADED_TENANCY=1), so no engine enforces organization boundaries; the console can raise an operator warning off it. A status signal, not a capability gate; absent means not degraded |
| oidcProvider | boolean | optional | Embedded OIDC authorization server wired, from the same decision that mounts it, so OAuth applications can be registered and managed; on by default alongside the MCP surface. It says nothing about sign-in providers, which socialProviders lists; the flag is default-on, so absent reads as on |
| deviceAuthorization | boolean | optional | Device authorization (browser-approved CLI login) wired, so the device-code endpoints answer; when false the console device-approval page says device authorization is not enabled instead of calling them. Absent means not wired |
| admin | boolean | optional | Admin plugin wired (forced on whenever SCIM is enabled), so user administration (creating, banning, unlocking and impersonating users, setting their passwords) is available; the console shows those actions only when it is true. Absent means not wired |
| termsUrl | string | optional | Terms-of-service link shown beneath the login and register cards: the trimmed OS_TERMS_URL value when set, otherwise the public ObjectStack terms page; absent when the operator set OS_TERMS_URL to an empty or blank (whitespace-only) value to suppress the link |
| privacyUrl | string | optional | Privacy-policy link shown beneath the login and register cards: the trimmed OS_PRIVACY_URL value when set, otherwise the public ObjectStack privacy page; absent when the operator set OS_PRIVACY_URL to an empty or blank (whitespace-only) value to suppress the link |
OneTimeTokenHandoffQuery
Properties
| Property | Type | Required | Description |
|---|---|---|---|
| redirect_uri | string | ✅ | Where to send the token: an absolute URI whose scheme is registered in AuthConfig.trustedAppSchemes (e.g. com.example.app://auth/callback); any other scheme is refused with 400 and no redirect |
| code_challenge | string | ✅ | RFC 7636 S256 code challenge: the unpadded base64url SHA-256 of the verifier the app keeps (43 characters) |
| code_challenge_method | 'S256' | optional | RFC 7636 challenge method; only S256 is accepted (plain is refused), and absent means S256 |
OneTimeTokenVerifyRequest
Properties
| Property | Type | Required | Description |
|---|---|---|---|
| token | string | ✅ | The hand-off token, a dot, then the RFC 7636 code verifier (43-128 characters) whose S256 challenge was sent to the hand-off |
OneTimeTokenVerifyResponse
Properties
| Property | Type | Required | Description |
|---|---|---|---|
| session | { id: string; expiresAt: string; token?: string; ipAddress?: string; … } | ✅ | The session the token was minted from |
| user | { id: string; email: string; emailVerified?: boolean; name: string; … } | ✅ | The signed-in user |
Nested Shape: OneTimeTokenVerifyResponse.user
| Property | Type | Required | Description |
|---|---|---|---|
| id | string | ✅ | User ID |
string | ✅ | Email address | |
| emailVerified | boolean | optional (default: false) | Is email verified? |
| name | string | ✅ | Display name |
| image | string | null | optional | Avatar URL |
| username | string | optional | Username (optional) |
| roles | string[] | optional (default: []) | Assigned role IDs |
| tenantId | string | optional | Current tenant ID |
| language | never | optional | [REMOVED] SessionUser.language was removed in @objectstack/spec 17.4.0 (ADR-0049 enforce-or-remove) — it was declared with a permanent default of 'en' and never produced by any session endpoint nor read by any client, so a reader keying on it saw a constant, not the user's language. Delete the key. Read the signed-in user's language from GET /auth/me/localization (locale: the user's own sys_user.locale when set → the request's Accept-Language → the deployment default). |
| timezone | string | optional | Preferred timezone |
| createdAt | string | optional | |
| updatedAt | string | optional |
OrganizationEditionChoice
Properties
| Property | Type | Required | Description |
|---|---|---|---|
| edition | string | ✅ | The value the organization-create door takes in its edition query parameter for this choice (snake_case, e.g. developer); the client sends it back unchanged when the choice is picked |
| label | string | ✅ | Display name of the choice, already resolved by the host in the language the request asked for; the form shows it as given |
| hint | string | ✅ | One line under the label saying what the choice means, already resolved by the host in the request language; the form shows it as given |
| memberLimit | integer | optional | Most members an organization of this edition may hold, when the edition caps them; the host's own figure, so a form that mentions the cap never spells a constant of its own. Absent means no cap is stated |