Auth API reference

Auth API · Consumer-Auth

post/{app_slug}/v1/auth/accept-invite

Accept an EndUser invite by code

Materialises a pre-allocated invite into a real EndUser: creates account + primary email contact (verified, since mailing the code proved control) + password credential + role membership, then mints app-scoped tokens. Public endpoint — the invite code is the authority. 410 on revoked/expired/exhausted invites; 409 on duplicate email or username. The same password policy as `/auth/signup` applies, including the common-password deny-list and the breach check, and so does the app-level MFA mandate: on an `auth_config.mfa: "required"` app the account is created but the response is `mfa_enrollment_required: true` with no session behind it.

Path parameters

app_slug*string

Slug of the app.

Request body

code*string

Invite code from the invitation email (`inv_…`).

Example: "inv_x7H2k3jLqXr"

password*string

Password the accepter sets for their new account.

Example: "CorrectHorseBatteryStaple"

usernamestring

Optional username override. Defaults to a derivation of the invite email local-part.

Example: "john_doe"

display_namestring

Optional display name shown back to the user.

Example: "Jane Doe"

Response · 201 Account created from the invite. A session was minted unless `mfa_enrollment_required` is present — branch on that flag.

object

Example

Request

POST https://api.auth.productcraft.co/{app_slug}/v1/auth/accept-invite
Content-Type: application/json

{
  "code": "inv_x7H2k3jLqXr",
  "password": "CorrectHorseBatteryStaple",
  "username": "john_doe",
  "display_name": "Jane Doe"
}

Response

{}