palbaseDocs

Palbase Auth API · API

POST/admin/users/invite

Invite a user

Invites a person to an account of the project's auth, as a project's server adds its staff. An address no account has: the account is made with no password (invited), and a link that sets its password is emailed (or answered, send_email false) — 201. An address made for a test (POST /admin/test-users/addresses) makes a test user, whose invitation is kept in its test inbox and sent nowhere; another .invalid address is 400 email_undeliverable. An account invited that has not taken the invitation up (no password, never signed in, not banned): it is invited again — a new link, the earlier ones spent, seven days from now, its metadata merged — 200. Any other account: 409 user_exists with its user_id and email_verified; nothing is sent and the account is left as it is (give a role to one whose address is confirmed). The link lives seven days and opens Palbase's page at the project's own address (or redirect_to): the person sets the password there, the address is confirmed, and they sign in with it. The account cannot sign in with a password before. 503 email_send_failed leaves the invitation open: the same call again sends a new link.

Called by your server, with the project's secret key.

Request body

emailstring (email) · required
metadataobject · optionalThe user's free-form metadata: any JSON object.
redirect_tostring · optionalWhere the invitation's link opens instead of Palbase's own page: a page of the app's, on the project's redirect allow-list (auth settings' redirect_urls). It receives ?token= and takes it, with the password the person chooses, to POST /auth/invitations/accept. Absent: the link opens Palbase's page at the project's own address — never site_url.
localestring · optionalThe BCP 47 language of the email and the page (absent: the project's default). Kept as the new account's.
send_emailboolean · optionalDefault true: Palbase emails the invitation, with the project's auth.user_invitation template. false: nothing is sent, and the answer carries the link (invitation.accept_url) for the caller to deliver.
curl
curl -X POST "https://<your-ref>.palbase.studio/admin/users/invite" \
  -H "apikey: $PALBASE_SECRET_KEY" \
  -H "content-type: application/json" \
  -d '{"email":"user@example.com"}'

Responses

200Invited again: an open invitation sent anew

201The account made and invited

400Validation failed or required field missing

401Missing, invalid, or expired credentials

403Not permitted with this key; or the project is the platform's own (`owner_only`): every change on its admin surface — any account's address, password, factors, sessions or roles, an account made or imported, a sign-in minted, a setting — is its owner's or its operator's alone. The request carries, besides the project's key, the owner's access token (X-Palbase-Owner; a passkey sign-in of the last 15 minutes, else 401 `insufficient_user_authentication`) or the operator's token (X-Palbase-Operator). Its key reads.

409The address has an account that is no open invitation (user_exists, with its user_id and email_verified)

503Downstream dependency unavailable (typically HIBP / breach service)

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

Operation AdminInviteUser of auth's contract.