Ready-Made Actions

Every endpoint, pre-generated & typed

You almost never write an endpoint against a Nucleus backend. generateAllEndpoints(config) reads the very same NucleusConfigOptions that boots the server and emits a complete, fully-typed catalog of actions — auth, sessions, passkeys, admin, tenants, verification, monitoring, runtime config and CRUD for every entity and system table.

Each entry below becomes actions.KEY.start({ payload, onAfterHandle, onErrorHandle }) on the useApiActions hook, with its payload, success and error types inferred from the config. Public actions need no session; everything else attaches the caller's cookies automatically through the server factory.

This page is the catalog — the 'what you get'. The API Client page covers the 'how' (generate → factory → hook). Together they are the entire frontend data layer; you provide the UI.

Authentication#

The core sign-in surface. Tokens are delivered as httpOnly cookies, so the browser never touches a raw JWT — REFRESH is even called for you on a 401 when you front the API with the nucleus-core-ts/proxy. Public actions need no session; the rest require one.

LOGINPOST · /auth/login · public

Email/username + password sign-in. On success sets the access + refresh cookies and returns the user with token metadata (LoginSuccess).

REGISTERPOST · /auth/register · public

Create an account. Enforces your password policy and, when email verification is on, leaves the account unverified until VERIFY_EMAIL.

REFRESHPOST · /auth/refresh · public when authentication.refresh.isPublic

Exchange the refresh cookie for a fresh access token. Not public out of the box — the action defaults to isPublic:false and the server only exposes it publicly when authentication.refresh.isPublic is set (needed for the auto-refresh-on-401 flow). When you front the API with the nucleus-core-ts/proxy (reverse proxy), it calls this automatically on a 401 and replays the request; the generated ApiCaller client itself does not retry — it surfaces the 401 to onErrorHandle.

MEGET · /auth/me

The authenticated user with resolved roles and claims — the canonical 'am I signed in?' check used to hydrate app state.

LOGOUTPOST · /auth/logout

Revoke the current session server-side and clear the auth cookies.

Password & email verification#

The complete credential-recovery and email-confirmation surface. Request/confirm and set are public — they carry their own emailed token (set consumes an invite token, with an x-user-id session only as a fallback); change requires a session.

PASSWORD_CHANGEPOST · /auth/password-change

Change the password of a signed-in user (current + new password).

PASSWORD_SETPOST · /auth/password-set · public

Set an initial password for accounts created without one (invited or passwordless users). Registered as always-public when passwordSet is enabled; its primary path consumes an emailed invite token, falling back to the x-user-id session only when no token is present.

PASSWORD_RESET_REQUESTPOST · /auth/password-reset/request · public

Trigger a reset email containing a single-use token.

PASSWORD_RESET_CONFIRMPOST · /auth/password-reset/confirm · public

Consume the reset token and store the new password.

VERIFY_EMAILGET · /verify-email · public

Confirm an email address with the token from the verification mail.

RESEND_VERIFICATIONPOST · /resend-verification · public

Re-send the verification email if the first one expired or was lost.

Passwordless, invites & captcha#

Alternative entry paths. Magic links and invites are two-step (request → verify); captcha guards sensitive public forms when enabled in config.

MAGIC_LINKPOST · /auth/magic-link · public

Email a one-time sign-in link to the address provided.

MAGIC_LINK_VERIFYGET · /auth/magic-link/verify · public

Exchange a magic-link token for a full session (LoginSuccess).

INVITEPOST · /auth/invite

Invite a user by email from inside the app (admin-side).

INVITE_VERIFYPOST · /auth/invite/verify · public

Accept an invitation and provision the invited account.

CAPTCHA_GENERATEGET · /auth/captcha/generate · public

Issue a captcha challenge to attach to a sensitive form.

CAPTCHA_VALIDATEPOST · /auth/captcha/validate · public

Validate the user's captcha answer before allowing the action.

Sessions & devices#

A full multi-device session manager. List and revoke devices, and — when new-device approval is enabled — surface pending sign-ins that an existing trusted device must approve or reject. This is exactly what the portal's Devices screen is built from.

SESSIONSGET · /auth/sessions

Every active session/device for the current user.

SESSIONS_CURRENTGET · /auth/sessions/current

Details of the session making this request (device, IP, last seen).

SESSIONS_STATSGET · /auth/sessions/stats

Summary counts — active, pending and total sessions.

SESSIONS_PENDINGGET · /auth/sessions/pending

New-device sign-ins awaiting approval from a trusted device.

SESSIONS_APPROVE / SESSIONS_REJECTPOST · /auth/sessions/approve|reject · public

Approve or reject a pending device by id. Registered as always-public whenever sessions are enabled: they authenticate via the emailed approval token, not a session cookie, so an existing trusted device can approve/reject a pending sign-in without the caller holding a session.

SESSIONS_REVOKEDELETE · /auth/sessions/:sessionId

Sign out a single session/device by id.

SESSIONS_REVOKE_ALLDELETE · /auth/sessions/all

Sign out everywhere at once (optionally keeping the current device).

SESSIONS_ADMIN_LISTGET · /auth/sessions/admin/:userId

List another user's active sessions by user id — the admin-side counterpart to SESSIONS, for offboarding and lost-device response. Guarded by godmin or a role named in authentication.sessions.adminRoles.

SESSIONS_ADMIN_REVOKEDELETE · /auth/sessions/admin/:userId

Revoke another user's sessions by user id (same godmin + adminRoles guard). Ends all of that user's active sessions, or a single one when a sessionId is passed in the body; the audit row records the acting admin, not the subject.

Passkeys · WebAuthn#

A complete FIDO2/WebAuthn passkey lifecycle. Both registration and passwordless login are a two-step options → verify handshake around the browser's navigator.credentials API; the remaining actions manage the user's saved credentials.

WEBAUTHN_REGISTER_OPTIONSPOST · /auth/webauthn/register/options

Get the creation options to pass to navigator.credentials.create().

WEBAUTHN_REGISTER_VERIFYPOST · /auth/webauthn/register/verify

Verify the attestation and persist the new passkey.

WEBAUTHN_AUTH_OPTIONSPOST · /auth/webauthn/authenticate/options · public

Get assertion options to pass to navigator.credentials.get() at sign-in.

WEBAUTHN_AUTH_VERIFYPOST · /auth/webauthn/authenticate/verify · public

Verify the assertion and issue a session — passwordless login.

WEBAUTHN_LISTGET · /auth/webauthn/credentials

List the user's registered passkeys with metadata.

WEBAUTHN_RENAME / WEBAUTHN_REVOKEPATCH|DELETE · /auth/webauthn/credentials/:credentialId

Rename or remove an individual passkey.

Social login · OAuth#

Provider-based sign-in and account linking. This whole group is generated only when authentication.oauth.enabled is set. Discovering providers and starting a redirect are public (the server also registers each provider's /callback as public); listing and unlinking a user's connected accounts require a session.

OAUTH_PROVIDERSGET · /auth/oauth/providers · public

List the OAuth providers configured on the server so the UI can render sign-in buttons.

OAUTH_REDIRECTGET · /auth/oauth/:provider · public

Begin the OAuth flow for a provider — redirects the browser to the provider's consent screen (the provider's :provider/callback is also public).

OAUTH_ACCOUNTSGET · /auth/oauth/accounts

List the OAuth accounts linked to the signed-in user.

OAUTH_UNLINKDELETE · /auth/oauth/unlink/:provider

Disconnect a linked provider from the signed-in user's account.

API keys#

Programmatic-access key management. This whole group is generated only when authentication.apiKeys.enabled is set, and every action inherits defaultIsPublic:false — all five require a session (none are public).

API_KEYS_CREATEPOST · /auth/api-keys

Mint a new API key for the signed-in user (the raw secret is returned once).

API_KEYS_LISTGET · /auth/api-keys

List the current user's API keys with metadata (never the raw secret).

API_KEYS_DETAILGET · /auth/api-keys/:id

Fetch a single API key's metadata by id.

API_KEYS_UPDATEPATCH · /auth/api-keys/:id

Update an API key by id (e.g. rename or adjust its settings).

API_KEYS_REVOKEDELETE · /auth/api-keys/:id

Revoke an API key by id, immediately invalidating it.

Admin & impersonation#

Privileged user-management actions guarded by claims. Impersonation mints a scoped session as another user (and back again) for support, and API keys give programmatic, cookie-less access.

ADMIN_CREATE_USERPOST · /auth/admin/create-user

Create a user directly, bypassing self-registration.

ADMIN_LIST_COHORTS / ADMIN_GET_COHORT / ADMIN_CREATE_COHORT / ADMIN_UPDATE_COHORT / ADMIN_DELETE_COHORT·/auth/admin/cohorts[/:id]

Full cohort lifecycle — list, read one (with its users), create, update and delete a cohort. Emitted only when authentication.cohorts.enabled.

ADMIN_COHORT_BULK_CREATEPOST · /auth/admin/cohorts/:id/bulk-create

Create many users at once into a cohort — explicit list or generated from a prefix/domain/count — returning created, skipped and generated passwords. Emitted only when authentication.cohorts.enabled.

ADMIN_COHORT_ACTIVATE / ADMIN_COHORT_DEACTIVATE / ADMIN_COHORT_DELETE_USERS / ADMIN_COHORT_EXPORT·/auth/admin/cohorts/:id/{activate-users|deactivate-users|delete-users|export}

Bulk membership operations on a cohort — activate or deactivate all its users, delete its users, and export the cohort. Emitted only when authentication.cohorts.enabled.

ADMIN_CHANGE_USER_IDPOST · /auth/admin/change-user-id

Re-key a user's id and cascade the change across references.

ADMIN_HARD_DELETE_USERDELETE · /auth/admin/hard-delete/:userId

Permanently delete a user (as opposed to the default soft delete).

ADMIN_IMPERSONATE / ADMIN_IMPERSONATE_STOPPOST · /auth/admin/impersonate[/stop]

Start acting as another user, then return to your own identity.

API_KEYS_CREATE / LIST / DETAIL / UPDATE / REVOKE·/auth/api-keys[/:id]

Full CRUD for scoped API keys — machine clients authenticate with a key instead of a session cookie. Emitted only when authentication.apiKeys.enabled.

Tenants#

Self-serve and admin-side multi-tenancy, pairing with database.isMultiTenant. Public actions cover the signup funnel; the rest manage the tenant lifecycle.

TENANT_CHECK_SUBDOMAINGET · /tenants/check-subdomain/:subdomain · public

Live availability check while the user types a subdomain at signup.

TENANT_SELF_SIGNUPPOST · /tenants/self-signup · public

Self-serve tenant creation — provisions a schema and first admin.

TENANT_PROVISIONPOST · /tenants/provision

Admin-side provisioning of a new tenant (schema + seed).

TENANT_LIST / TENANT_DETAILGET · /tenants[/:id]

Browse all tenants or load one with its status and metadata.

TENANT_SUSPEND / TENANT_REACTIVATEPOST · /tenants/:id/suspend|reactivate

Disable or restore a tenant's access without deleting its data.

Verification, monitoring & runtime config#

The operational surface that powers approval queues, live dashboards and the runtime config editor — all type-safe actions, no bespoke endpoints.

VERIFICATION_PENDINGGET · /verifications/pending

Records awaiting your approval across every verification flow. Emitted only when verification.enabled.

VERIFICATION_STATUSGET · /verifications/status/:entity_name/:entity_id

Where a specific record sits in its approval graph. Emitted only when verification.enabled.

VERIFICATION_DECIDEPOST · /verifications/:entity_name/:entity_id/decide

Approve or reject the current step, with an optional signature/comment. Emitted only when verification.enabled.

VERIFICATION_START / START_FOR_ENTITY / HISTORY / ENTITY_STATUSES·/verifications/*

Start a flow for a record (by flow_id or auto-selected), read a record's decision history, and list statuses for an entity type. Emitted only when verification.enabled.

FLOW_LIST / FLOW_GET / FLOW_SAVE / FLOW_PUBLISH / FLOW_DELETE·/verification-flows[/:flow_id]

List and read, then author, publish and remove the verification flow graphs themselves. Emitted only when verification.enabled AND verification.flowEndpoints.enabled.

NOTIFICATION_LIST / UNSEEN_COUNT / MARK_SEEN / MARK_ALL_SEEN·/notifications[/*]

Read in-app notifications and the unread count, and mark one or all as seen — the portal notification center. Emitted only when verification.enabled AND notification.enabled AND notification.endpoints.enabled.

MONITORING_HEALTH_CHECK / GET_LOGS / GET_SETTINGS / CHANGE_SETTINGSGET|PATCH · /monitoring/*

Health check, the live activity feed, and read/tune live-monitoring settings. Emitted only when liveMonitoring.enabled.

CONFIG_GET / CONFIG_SECTIONS / CONFIG_SECTION_GETGET · /nucleus/config[/*]

Inspect the live config with secrets masked, section by section.

CONFIG_SECTION_UPDATEPATCH · /nucleus/config/:section

Hot-patch a reloadable section; the response says if a restart is required.

CONFIG_ENV / CONFIG_OVERRIDES_* / CONFIG_RESTART·/nucleus/config/*

See which env-var references resolved, manage runtime overrides, and schedule a graceful restart.

Chat#

The realtime messaging surface — 1:1 and group conversations, messages, read state, typing and participant management. Emitted only when chat.enabled; pairs with the ChatPanel frontend component.

CHAT_LIST_CONVERSATIONS / CHAT_CREATE_CONVERSATION / CHAT_GET_CONVERSATION·/chat/conversations[/:id]

List your conversations (limit/offset), start a new 1:1 or group conversation, and load one by id.

CHAT_GET_MESSAGES / CHAT_SEND_MESSAGE·/chat/conversations/:id/messages

Page a conversation's messages (limit/before cursor) and post a new message into it.

CHAT_MARK_READ / CHAT_TYPINGPOST · /chat/conversations/:id/{read|typing}

Mark the conversation read (optionally up to a messageId) and broadcast a typing indicator.

CHAT_ADD_PARTICIPANTS / CHAT_REMOVE_PARTICIPANTPOST · DELETE · /chat/conversations/:id/participants[/:userId]

Add users to a group conversation or remove a single participant.

CHAT_EDIT_MESSAGE / CHAT_DELETE_MESSAGEPATCH · DELETE · /chat/messages/:id

Edit a message's content or delete it.

Custom domains#

The custom-hostname and domain-registration lifecycle — let tenants attach their own apex/www/subdomains with DNS verification and SSL, and optionally register/transfer managed domains. Emitted only when domains.enabled; these are the hardened routes behind the godmin-locked domain_* system tables.

DOMAIN_RESOLVEGET · /domains/resolve · public

Resolve a hostname to its tenant/owner — the public lookup used at request routing.

DOMAIN_CREATE_HOSTNAME / DOMAIN_LIST_HOSTNAMES / DOMAIN_GET_HOSTNAME·/domains/hostnames[/:id]

Attach a custom hostname, list attached hostnames (by owner/tenant), and load one by id.

DOMAIN_HOSTNAME_INSTRUCTIONS / DOMAIN_VERIFY_HOSTNAME / DOMAIN_REFRESH_HOSTNAME·/domains/hostnames/:id/{instructions|verify|refresh-status}

Read the DNS records to set, trigger ownership/SSL verification, and refresh the live status.

DOMAIN_ACTIVATE_HOSTNAME / DOMAIN_DISABLE_HOSTNAME / DOMAIN_MAKE_PRIMARYPOST · /domains/hostnames/:id/{activate|disable|make-primary}

Activate or disable a verified hostname, and promote one to the tenant's primary domain.

DOMAIN_CREATE_REGISTRATION / DOMAIN_LIST_REGISTRATIONS / DOMAIN_GET_REGISTRATION·/domains/registrations[/:id]

Start a managed domain registration (Domain Concierge), list registrations, and load one by id.

DOMAIN_CANCEL_REGISTRATION / DOMAIN_TRANSFER_OUTPOST · /domains/registrations/:id/{cancel|transfer-out}

Cancel a pending registration or transfer a managed domain out to another registrar.

Marketplace money#

The provider-neutral marketplace money layer — immutable split ledger, balances/reserves, the payout-request workflow, disputes and settlement policy. Emitted only when payment.enabled AND payment.marketplace.enabled; these are the hardened routes behind the godmin-locked payment_* money tables.

PAYMENT_MARKETPLACE_RECORD_SPLIT / PAYMENT_MARKETPLACE_LIST_SPLITS·/payment/marketplace/splits

Record a commission split into the immutable ledger and list splits (by recipient/status).

PAYMENT_MARKETPLACE_BALANCE / PAYMENT_MARKETPLACE_RELEASE_RESERVE·/payment/marketplace/{balance/:ownerId|reserves/:id/release}

Read an owner's available/reserved balance and release a risk reserve back to available.

PAYMENT_MARKETPLACE_GET_SETTLEMENT_POLICY / PAYMENT_MARKETPLACE_UPSERT_SETTLEMENT_POLICYGET · POST · /payment/marketplace/settlement-policy

Read and upsert the delayed-settlement policy (hold window, reserve rate) for an owner.

PAYMENT_MARKETPLACE_REQUEST_PAYOUT / LIST_PAYOUTS / GET_PAYOUT·/payment/marketplace/payout-requests[/:id]

Request a payout of available balance, list payout requests (by recipient/status), and load one.

PAYMENT_MARKETPLACE_APPROVE_PAYOUT / PAYMENT_MARKETPLACE_REJECT_PAYOUTPOST · /payment/marketplace/payout-requests/:id/{approve|reject}

Approve or reject a pending payout request in the operator workflow.

PAYMENT_MARKETPLACE_OPEN_DISPUTE / LIST_DISPUTES / RESOLVE_DISPUTE·/payment/marketplace/disputes[/:id[/resolve]]

Open a dispute, list disputes (by owner/status), and resolve one (won/lost/accepted/cancelled).

Entity CRUD & bulk#

For every entity you declare — and every built-in system table — the generator emits a typed action set named by entity. Key names follow the table name: the list and distinct keys keep the full (typically plural) table name (GET_PRODUCTS, GET_PRODUCTS_DISTINCT), while the create/update/patch/delete/by-id keys use the singular form (ADD_PRODUCT, GET_PRODUCT_BY_ID) and the bulk keys keep the full name (BULK_ADD_PRODUCTS). The URL segment (shown below as /<entity>) is the camelCased table name — single-word tables look unchanged (products → /products), but multi-word tables camelCase (user_roles → /userRoles, audit_logs → /auditLogs), while the action key keeps its UPPER_SNAKE form (GET_AUDIT_LOGS). List actions speak the full Query API (filters, sort, pagination, relations); writes honour your soft-delete and verification settings. Columns a table declares sensitive:true are stripped from both list (GET_<ENTITY>) and detail (GET_<ENTITY>_BY_ID) responses — as well as from GET_<ENTITY>_DISTINCT and /auth/me — for any caller who lacks the per-column read claim, so a typed response may legitimately omit those fields.

lib/api/factory.ts — one registry, everything typed
1import { generateAllEndpoints, CONFIG_ENDPOINTS } from "nucleus-core";2import nucleusConfig from "@/config.json";3 4// generateAllEndpoints folds together auth, admin, tenant, cohort,5// verification, monitoring, chat, custom-domains, marketplace-money,6// system tables AND your own entities.7// It does NOT include the CONFIG_* actions — pass CONFIG_ENDPOINTS via the8// extraEndpoints arg to fold them into the same typed registry.9export const endpoints = generateAllEndpoints(nucleusConfig, CONFIG_ENDPOINTS);10export type AllEndpoints = typeof endpoints;11 12// In a component every key above is actions.KEY.start({ ... }):13//   actions.LOGIN.start({ payload, onAfterHandle, onErrorHandle })14//   actions.SESSIONS_REVOKE_ALL.start({ ... })15//   actions.GET_PRODUCTS.start({ payload: { page: 1, filters: [...] } })
GET_<ENTITY>GET · /<entity>

List or fetch with StandardQueryParams; returns a typed StandardReturn.

Example: GET_PRODUCTS, GET_ORDERS

ADD_<ENTITY>POST · /<entity>

Create a record from a payload typed to that entity's columns.

Example: ADD_PRODUCT

GET_<ENTITY>_BY_IDGET · /<entity>/:id

Fetch a single record by id (typed StandardReturn).

Example: GET_PRODUCT_BY_ID

GET_<ENTITY>_DISTINCTGET · /<entity>/distinct/:field

Distinct values of a readable field (authz + sensitive-column guarded).

Example: GET_PRODUCTS_DISTINCT

UPDATE_<ENTITY> / PATCH_<ENTITY>PUT · PATCH · /<entity>/:id

Full (PUT) or partial (PATCH) update of a record by id.

Example: UPDATE_PRODUCT, PATCH_PRODUCT

DELETE_<ENTITY>DELETE · /<entity>/:id

Delete a record (soft or hard per your entity config).

Example: DELETE_PRODUCT

BULK_ADD / BULK_UPDATE / BULK_DELETE_<ENTITY>SPOST · PUT · DELETE · /<entity>/bulk

Insert, update or delete many rows in one request (bulk endpoints). Emitted only when the entity sets bulk_endpoints_enabled.

Example: BULK_ADD_PRODUCTS, BULK_UPDATE_PRODUCTS, BULK_DELETE_PRODUCTS

System tables (ready out of the box)users, roles, claims, audit_logs, …

The same CRUD set — EXCEPT the /distinct action, which is generated only for your declared entities — is pre-generated for the 11 built-in tables (profiles, addresses, phones, files, users, roles, claims, user_roles, role_claims, audit_logs, monitoring_metrics). Action keys follow the SAME table-name derivation as declared entities, so they are NOT the PascalCase names: the users table yields GET_USERS / ADD_USER / GET_USER_BY_ID / UPDATE_USER / PATCH_USER / DELETE_USER, roles yields GET_ROLES / ADD_ROLE / …, audit_logs yields GET_AUDIT_LOGS, and so on. The 'SystemUser / SystemRole / SystemClaim / …' PascalCase names are the TypeScript entity/type aliases only (e.g. SystemUserEntity = InferEntity<SystemTables, 'users'>), never the runtime action keys. Note: generic-CRUD WRITES are godmin-locked for two groups of tables — (1) the RBAC tables among the 11 (roles, claims, user_roles, role_claims), and (2) sensitive system/feature tables: custom-domain routing (domain_hostnames, domain_registrations, domain_provider_records, domain_verification_challenges, domain_events), every payment_* money table, verifications, and auth-secret/session tables (api_keys, magic_link_tokens, user_sessions, trusted_devices). ADD/UPDATE/PATCH/DELETE to any of these return 403 for a non-godmin caller; legitimate owner writes go through the dedicated hardened routes (the authorization APIs, /domains/hostnames, /sub-merchants, /invoices, /subscriptions, /cards, …).

Example: GET_USERS, ADD_USER, GET_USER_BY_ID, UPDATE_USER, PATCH_USER, DELETE_USER, GET_ROLES, ADD_ROLE, GET_AUDIT_LOGS

Related sections