API 參考
Auth
Customer API: GET /auth/protection, POST /auth/challenge, POST /auth/verify, …
Response 200
provider"kanorio" | "turnstile" | "recaptcha" | "hcaptcha"requiredentry"forms" | "customer_login"requiredaltchaobjectBuilt-in proof-of-work challenge (provider kanorio only).
altcha.algorithmstringrequiredaltcha.challengestringrequiredaltcha.maxnumberintegeraltcha.saltstringrequiredaltcha.signaturestringrequiredsiteKeystringWidget site key (third-party providers).
actionstringPass this as the widget action; the server checks it.
cDatastring | nullTurnstile cData to pass to the widget; null for other providers.
recaptchaVersion"v2" | "v3" | nullvisiblebooleanWhen true, show the check to the visitor instead of running it silently (the site is seeing unusual sign-in volume).
uploadTokenstringForms with a third-party provider only: send this as _tk (with _ctx set to the form id) when requesting file upload tickets. The widget token is single-use, so it is checked on submit instead.
Errors
WEBSITE_NOT_FOUND404RATE_LIMITED429
curl -X GET "https://{site}/api/v1/customer/auth/protection"Request body
emailstringrequiredlocalestringreturnTostring_hpstringHoneypot. Send an empty string; any value marks the request as automated.
_wpstringSecond honeypot. Send an empty string.
_costringThird honeypot. Send an empty string.
_tsintegerWhen the form was rendered, in Unix milliseconds.
_tkstringBuilt-in bot check: the solved ALTCHA payload for the challenge (provider kanorio).
_ctxstringWhat the built-in challenge was issued for: the form id, or customer-login:{siteId}.
captchaTokenstringThird-party bot check: the token from the provider's widget (provider turnstile, recaptcha or hcaptcha).
Errors
INVALID_EMAIL400BOT_PROTECTION_FAILED403WEBSITE_NOT_FOUND404SHARED_SENDER_PAUSED503
curl -X POST "https://{site}/api/v1/customer/auth/challenge" \
-H "Content-Type: application/json" \
-d '{}'Exchange a code, magic-link token or social sign-in handoff ticket for a Bearer session
/auth/verifyRequest body
method"code"requiredemailstringrequiredcodestringrequired
Response 200
sessionTokenstringrequiredtokenType"Bearer"requiredchannel"bearer"requiredexpiresAtstringrequiredcontactIdstringrequiredreturnTostring | null
Errors
INVALID_CODE400ACCOUNT_BLOCKED422EMAIL_NOT_VERIFIED422METHOD_DISABLED422
curl -X POST "https://{site}/api/v1/customer/auth/verify" \
-H "Content-Type: application/json" \
-d '{}'Start a social sign-in (Google) and get the provider URL to redirect to
/auth/oauth/startRequest body
method"google"requiredA social sign-in method the site has enabled (see `customerAccess.methods` on the site).
returnTostringSame-site path to return to after sign-in.
localestringbaseUrlstringOrigin of the page that hosts the sign-in UI. Must be one of the site's allowed origins; the handoff ticket is sent back there.
Response 200
urlstringrequiredRedirect the browser here. The provider sends it back to your page with `?handoff=` to exchange at `/auth/verify`.
Errors
METHOD_DISABLED422RATE_LIMITED429
curl -X POST "https://{site}/api/v1/customer/auth/oauth/start" \
-H "Content-Type: application/json" \
-d '{}'Request body
originstringOrigin the WebAuthn ceremony runs on. Only `localhost` origins are honoured; production always uses the site's primary domain.
Response 200
optionsobjectrequired`PublicKeyCredentialRequestOptionsJSON` for `navigator.credentials.get()`.
challengeIdstringrequired
Errors
METHOD_DISABLED422RATE_LIMITED429
curl -X POST "https://{site}/api/v1/customer/auth/passkey/options" \
-H "Content-Type: application/json" \
-d '{}'Request body
challengeIdstringrequiredresponseobjectrequired`AuthenticationResponseJSON` from the browser.
returnTostringlocalestring
Response 200
sessionTokenstringrequiredtokenType"Bearer"requiredchannel"bearer"requiredexpiresAtstringrequiredcontactIdstringrequiredreturnTostring | null
Errors
VERIFY_FAILED422CHALLENGE_EXPIRED422ACCOUNT_BLOCKED422RATE_LIMITED429
curl -X POST "https://{site}/api/v1/customer/auth/passkey/verify" \
-H "Content-Type: application/json" \
-d '{}'