Skip to navigation

Login (Create Session)

Authenticate a member with email/password credentials, or open an admin preview session.

Authentication: Public initiation endpoint — no Bearer token is required because this call creates one. On api.customerhub.com HMAC application authentication is still required. Browser anti-abuse applies: when reCAPTCHA is enabled (it is in production), recaptcha_token is required, and HMAC does not exempt the request from it. There is currently no supported server-to-server member login — see the Authentication overview.

Tenant resolution: The member is looked up in one app only. On the tenant host that is the request’s subdomain; on the API host it is the app the API key belongs to. Member accounts are per app, so the same email in two apps is two different members, and the returned token is bound to that app.

Request body:

  • email (required) — Member’s email address
  • password (required) — Member’s password
  • recaptcha_token (required when reCAPTCHA is enabled) — reCAPTCHA v3 token solved in the browser on the tenant’s hostname, using the recaptcha_site_key from GET /app
  • user_ip (optional) — Client IP for analytics
  • to (optional) — Redirect path after login

Alternative: Admin preview mode (reCAPTCHA is not checked):

  • token (required) — Admin preview token
  • app (required) — App subdomain

Response:

  • token — JWT auth token, valid for 30 days (store this for subsequent requests)
  • location — Redirect URL (first nav item or specified to path)
  • the member’s profile fields at the top level of data (id, first_name, last_name, name, initials, email, avatar_url, status, bio, phone, website, social handles, otp_enabled, passkey_registered, last_seen_at, created_at, updated_at, …) — there is no nested user object

2FA Flow: If the member has two-factor authentication enabled, the response will instead return:

  • otp_required: true
  • otp_token — Temporary token (5 min expiry) to use with the Verify OTP endpoint

Side effects: Triggers a UserLogin event (not for admin preview users).

Errors:

  • 422 — reCAPTCHA verification failed (recaptcha_token missing, invalid, expired, scored too low, or solved on a different hostname)
  • 401 — Invalid credentials for this app
  • 404 — App not found (preview mode only)

Test script: Automatically saves the returned token to auth_token collection variable.

Request

This endpoint expects an object.
emailstringOptional
passwordstringOptional
recaptcha_tokenstringOptional
user_ipstringOptional

Response

OK