palbaseDocs

Palbase Auth API · API

POST/auth/anonymous/convert

Ask for the signed-in guest to become an account with an e-mail and a password

Asks for the signed-in guest to become an account with an e-mail address and a password, under the same id. The address's owner says so: the code or link is mailed to the address (never in the answer), and until it is redeemed — the code at POST /auth/anonymous/convert/verify, in this guest's own session; the link's token at POST /auth/verify-email — the account is still a guest — its sessions, its tokens' is_anonymous and what it did go on as a guest's, and the address is nobody's: it signs in to nothing and is confirmed for no one. Redeemed, the guest becomes the account — address confirmed, the same id, its sessions going on (the next refresh carries tokens without is_anonymous) — and user.converted is told. Asking again replaces the waiting address; an account that takes the address meanwhile wins it (redeeming then answers 409 email_exists). Any age of session will do — a guest has nothing to sign in again with.

409 email_exists when another account holds the address: nothing changes, the guest stays signed in, and the person signs in to that account instead. 409 not_anonymous for an account that is no guest. Held to the project's password policy and known breaches (400), to its before.user.create hook (403 hook_denied) and to signup's per-address limit (429). Other guests waiting on the address do not stop this one: each has its own code, entered only in its own session; 503 means a check, the server's hashing capacity or the mail is momentarily unavailable and the same request can be retried (see Retry-After); 429 with the mail's code when the project's e-mail is used up.

Called by a signed-in user of your app, with their token and the publishable key.

Request body

emailstring (email) · required
passwordstring (password) · requiredHeld to the project's password policy and checked against known breaches, as a signup's.
redirect_tostring (uri) · optionalWhere the verification link lands: an address the auth settings' redirect_urls allow, or one of the project's web apps' redirects (apps:env:set --redirect); any other is refused (invalid_redirect).
curl
curl -X POST "https://<your-ref>.palbase.studio/auth/anonymous/convert" \
  -H "apikey: $PALBASE_PUBLISHABLE_KEY" \
  -H "authorization: Bearer $USER_ACCESS_TOKEN" \
  -H "content-type: application/json" \
  -d '{"email":"user@example.com","password":"string"}'

Responses

202Waiting on the address: the code or link was mailed to it

400Validation failed or required field missing

401Missing, invalid, or expired credentials

403Authenticated but not permitted (banned, hook denial, role mismatch)

409Conflict with current resource state (duplicate, race)

429Rate limit exceeded

503Downstream dependency unavailable (typically HIBP / breach service)

defaultAn error: the envelope names it (`error`) and explains it (`error_description`).

Operation ConvertAnonymousUser of auth's contract.