Skip to main content
Docs

Authentication routes

These routes are used by the dashboard. Integrations authenticate with API keys instead; see Authentication. Signing up never returns a session: it answers 202 and emails a verification link. Public routes here are not idempotency-stored, and sign-in and verification routes have their own rate limits.

The base is https://holdyn-fb2e34c7cbae.herokuapp.com/api/v1/b2b. Every endpoint below lists who may call it.

At a glance#

Objects

Identity: Member, Me, Session, MfaChallenge, MfaEnrollment, MfaBackupCodes

Identity: Member, Me, Session, MfaChallenge, MfaEnrollment, MfaBackupCodes (example values)
{
  "id": "mem_6543a1b2c3d4e5f6a7b8c9d1",
  "object": "member",
  "email": "founder@acme.example",
  "name": "Alex M.",
  "role": "owner",
  "status": "active",
  "role_changed_at": "2026-11-02T08:55:00.000Z",
  "approver_cooling_until": null,
  "pending_role_change": null,
  "mfa_enabled": true,
  "mfa_locked_until": null,
  "email_verified_at": "2026-11-02T08:58:00.000Z",
  "last_login_at": "2026-11-05T16:40:00.000Z",
  "invited_by": null,
  "is_legacy_owner": false,
  "removed_at": null,
  "removed_by": null,
  "credentials_disposition": null,
  "created_at": "2026-11-02T08:55:00.000Z",
  "updated_at": "2026-11-05T16:40:00.000Z"
}

Endpoints

POST/auth/signup

Credential
None
Mode
n/a

Request

email string required (valid address, ≤ 254); password string required (12–128, not equal to the email); name string required (1–120); company_name string required (1–200, no CR/LF); legal_name string optional (≤ 200); country string required (ISO 3166-1 alpha-2, uppercase); phone string optional (≤ 40); accepted_terms_version string optional (1–40; the Holdyn Business Terms version shown at the signup checkbox; recorded verbatim in tenant.signed_up data.accepted_terms_version and on Tenant.terms_accepted {version, accepted_at}; optional until the founders publish the Terms, then a contract revision makes it required).

Response

202 Accepted with status: "verification_sent". Never a session.

Errors

400 weak_password, parameter_invalid (email, country).

Record and events

tenant.signed_up (genesis of the live chain) · Events: —

Notes

creates B2bAccount{accountStatus: access_requested, legacyApiEnabled: false, publicSlug from company_name (+4-char suffix on collision)}, owner B2bMember{role: owner, status: pending_email} and an email_verification challenge (24 h) emailed as {DASHBOARD}/verify-email#t=…; notifies Holdyn admins (existing notifyAdminOfB2bAccessRequest + Slack SIGNUPS). An email that already has a B2B login gets the same 202 and an email saying an account exists (no enumeration). Until a Holdyn admin approves the tenant, test-mode party email is captured and the portal shows no tenant logo.

POST/auth/verify-email

Credential
None
Mode
n/a

Request

token string required (raw token from the fragment).

Response

200 {"object": "email_verification", "status": "verified", "email": "founder@acme.example", "next": "login"} (no session: the member signs in next).

Errors

400 token_invalid, token_expired.

Record and events

tenant.email_verified · Events: —

Notes

member pending_email → active, emailVerifiedAt = now. The tenant can now use test mode fully.

POST/auth/resend-verification

Credential
None
Mode
n/a
Idempotency
not stored

Request

email string required.

Response

202 Accepted (status: "accepted"), always.

Notes

sends a new token only if a pending_email member exists; the previous token stops working.

POST/auth/login

Credential
None
Mode
n/a

Request

email string required; password string required (1–128; no minimum here, legacy passwords stay valid).

Response

200 Session, or 200 MfaChallenge when the member has MFA enabled (10 min, 5 attempts).

Errors

401 invalid_credentials (unknown email, wrong password, locked member, or MFA locked: one generic answer); after a CORRECT password only: 403 email_not_verified, member_suspended, tenant_rejected, tenant_offboarded.

Record and events

member.locked_out (when the failure count reaches B2B_FAILED_LOGIN_THRESHOLD); member.joined with data.via: "legacy_migration" when a legacy account owner is migrated on first login · Events: —

Notes

order per (limiter → lookup by emailKey → lockout → bcrypt against a dummy hash when unknown → status checks). A suspended tenant may log in (read-only; tenant.lifecycle says so). The JWT TTL is B2B_DASHBOARD_SESSION_TTL_HOURS (default 12).

POST/auth/login/mfa

Credential
Sign-in challenge
Mode
n/a
Idempotency
not stored

Request

challenge_token string required (hmfa_…); exactly one of code (6 digits) or backup_code (16 base32 characters; hyphens and spaces ignored).

Response

200 Session (amr: ["pwd","otp"], mfa_at = now, so the session is already stepped-up for 15 min).

Errors

401 invalid_mfa_code (+ attempts_remaining), 401 mfa_challenge_expired; 400 parameter_invalid (both or neither code fields).

Record and events

member.mfa_locked when this failure is the 10th in 24 h (the member is emailed mfa_locked; MFA is locked for 1 h).

Notes

a used backup code is burnt (Me.mfa.backup_codes_remaining); the same TOTP time step is never accepted twice (lastStep).

POST/auth/logout

Credential
Member session
Permission
any (self)
Mode
tenant-wide
Idempotency
honoured

Request

none.

Response

200 {"object": "logout_result", "current_session_revoked": true, "sessions_revoked": false}.

Record and events

— (signing out is not a consequential action).

Notes

puts this session's jti on a Redis denylist until the token's exp (key b2b:jti:<jti>); authenticate rejects a denylisted jti with 401 session_revoked. If Redis is unavailable the answer is still 200 with current_session_revoked: false (the client discards the token anyway; use logout-all to revoke server-side by tokenVersion).

POST/auth/logout-all

Credential
Member session
Permission
any (self)
Mode
tenant-wide
Idempotency
not stored

Request

none.

Response

200 {"object": "logout_result", "current_session_revoked": true, "sessions_revoked": true}.

Record and events

member.sessions_revoked.

Notes

bumps the caller's tokenVersion; every session of this member (including this one) is now 401 session_revoked.

GET/auth/me

Credential
Member session
Permission
any
Mode
tenant-wide (the header is validated)

Response

200 Me.

PATCH/auth/me

Credential
Member session
Permission
any (self)
Mode
tenant-wide
Idempotency
honoured

Request

name string optional (1–120); notification_prefs object optional (keys = member-audience template ids; values boolean; null deletes).

Response

200 Me.

Errors

400 parameter_invalid (unknown template id, or false on a mandatory template).

Record and events

— (preferences are not consequential actions).

POST/auth/password/forgot

Credential
None
Mode
n/a
Idempotency
not stored

Request

email string required.

Response

202 Accepted, always.

Notes

if an active member exists, a 1-hour password_reset token is emailed as {DASHBOARD}/reset-password#t=….

POST/auth/password/reset

Credential
None
Mode
n/a
Idempotency
not stored

Request

token string required; password string required (12–128, ≠ email).

Response

200 {"object": "password_reset", "status": "password_reset", "next": "login"}.

Errors

400 token_invalid, token_expired, weak_password.

Record and events

member.password_reset.

Notes

bumps tokenVersion (all sessions revoked), clears the lockout. MFA stays enabled (a reset never bypasses MFA at the next login).

POST/auth/password/change

Credential
Member session
Permission
any (self)
Mode
tenant-wide
Step-up
required whenever the member has MFA enabled (any mode)

Request

current_password string required; password string required (12–128, ≠ email, ≠ current).

Response

200 Session (a new token; the old one dies with the tokenVersion bump).

Errors

400 parameter_invalid (param: "current_password" when wrong; never 401, so clients do not drop the session), weak_password.

Record and events

member.password_changed.

POST/auth/mfa/enroll

Credential
Member session
Permission
any (self)
Mode
tenant-wide
Idempotency
not stored

Request

none.

Response

200 MfaEnrollment (secret stored encrypted, not active until activate; a second enroll replaces the pending secret).

Errors

409 mfa_already_enabled; 503 b2b_secrets_unconfigured (no B2B_SECRETS_KEY: TOTP secrets are never stored in plaintext).

POST/auth/mfa/activate

Credential
Member session
Permission
any (self)
Mode
tenant-wide
Idempotency
not stored

Request

code string required (6 digits).

Response

200 {"object": "mfa_activation", "backup_codes": ["7KQ4-M2XD-9PLA-TT3B", "…10 codes of 16 base32 characters"], "session": Session} (codes shown once; session has mfa_at = now).

Errors

400 invalid_mfa_code; 409 mfa_already_enabled; 409 invalid_state_transition (current_state: "not_enrolled").

Record and events

member.mfa_enabled · Notes: email mfa_changed.

POST/auth/mfa/disable

Credential
Member session
Permission
any (self)
Mode
tenant-wide
Idempotency
not stored

Request

password string required; code string required (TOTP or backup code).

Response

200 Session (new token; tokenVersion bumped).

Errors

400 parameter_invalid (password), invalid_mfa_code; 403 mfa_locked; 409 mfa_not_enabled.

Record and events

member.mfa_disabled · Notes: email mfa_changed. Live consequential actions then answer mfa_enrollment_required where the tenant requires MFA.

POST/auth/mfa/step-up

Credential
Member session
Permission
any (self)
Mode
tenant-wide
Idempotency
not stored

Request

exactly one of code (6 digits) or backup_code.

Response

200 Session with mfa.step_up_valid_until = now + 15 min.

Errors

400 invalid_mfa_code (+ attempts_remaining); 403 mfa_locked (+ available_at: ≥ 10 MFA failures in 24 h across login and step-up lock MFA for 1 h); 409 mfa_not_enabled.

Record and events

member.mfa_locked (on the locking failure) · Notes: replay guard: the same TOTP time step is never accepted twice (mfa.lastStep, computed with otpauth TOTP.validate's delta).

POST/auth/mfa/backup-codesNot available yet

This route answers 422 feature_not_available until it ships.

Credential
Member session
Permission
any (self)
Mode
tenant-wide
Idempotency
not stored

Request

code string required (TOTP).

Response

200 MfaBackupCodes; previous codes stop working.

Errors

400 invalid_mfa_code; 403 mfa_locked; 409 mfa_not_enabled.

Record and events

member.mfa_backup_codes_regenerated (P1).

POST/auth/invitations/preview

Credential
None
Mode
n/a
Idempotency
not stored

Request

token string required (from #t=; sent in the body, never in a URL).

Response

200 InvitationPreview.

Errors

400 token_invalid (unknown, revoked, accepted, still pending_approval), token_expired.

POST/auth/invitations/accept

Credential
None
Mode
n/a
Idempotency
not stored

Request

token string required; name string required (1–120); password string required (12–128, ≠ email).

Response

200 Session.

Errors

400 token_invalid, token_expired, weak_password; 409 email_in_use (the email already has a B2B login at any tenant), invitation_invalidated (the inviter is no longer active or may no longer grant this role).

Record and events

member.joined · Notes: creates the member active with emailVerifiedAt = now and roleChangedAt = now (an approver-capable role starts its new-approver cooling); invitation → accepted.

POST/auth/test-recipients/confirm

Credential
None
Mode
n/a
Idempotency
not stored

Request

token string required (from {DASHBOARD}/confirm-test-recipient#t=…, 72 h).

Response

200 {"object": "test_recipient_confirmation", "status": "verified", "email_hint": "q***@acme.example", "tenant_display_name": "Acme"}.

Errors

400 token_invalid, token_expired.

Record and events

— (the address only becomes eligible to receive TEST-mode party email; nothing consequential changes).

Notes

, : an address added to settings.test_recipients receives party email in test mode only after its owner confirms it here.

Authentication routes · Holdyn Business docs