/{app_slug}/v1/auth/accept-tenant-inviteAccept a tenant invite by code
Materialises a pending `tenant_invite` into a real EndUser: creates account + verified primary email contact (mailing the code proved control of the address) + password credential + an app-level membership on the app's signup default role + a tenant membership on the role the invite names, then mints a session already scoped to that tenant, so the access token carries `org_id` / `org_role` with no follow-up switch-tenant call. Public endpoint — the invite code is the authority. 410 on revoked/expired/exhausted invites. **409 when an account already exists for the invited address**: this endpoint will not set a password on, or mint a session for, an account it did not create, because the plaintext code is also held by whoever minted the invite. Existing users sign in and call `POST /:appSlug/v1/me/tenant-invites/accept` instead, which adds the membership without touching credentials.
Path parameters
app_slug*stringSlug of the app.
Request body
code*stringTenant invite code from the invitation email (`tinv_…`). Distinct from the app-level `inv_…` codes `/auth/accept-invite` takes.
Example: "tinv_9dK2mQ7pR4vXbN1sT6yZ0hLcJeW3fAgU"
password*stringPassword the accepter sets for their new account. Validated against the app's password policy.
Example: "CorrectHorseBatteryStaple"
usernamestringOptional username override. Defaults to a derivation of the invited email local-part.
Example: "john_doe"
display_namestringOptional display name shown back to the user.
Example: "Jane Doe"
Response · 201 Account created from the invite and a tenant-scoped session minted.
result*objectAlways `session` here: a session was minted. Discriminates the sign-in results (`session`, `mfa_required`, `mfa_enrollment_required`).
access_token*stringShort-lived JWT signed with the app-scoped JWKS key. Carries sub, role, permissions[], type=end_user.
refresh_token*stringLong-lived opaque-ish JWT used to mint a new access token via /auth/refresh. Rotated on use.
token_type*stringAlways `Bearer`.
Example: "Bearer"
expires_in*numberAccess-token lifetime in seconds.
Example: 3600
password_warningsarrayNon-fatal notes about the password that was just set. Present only on `signup` and `accept-invite`, and only when the app runs `password_breach_check: "warn"` and the password was found in a public breach corpus — the value is then `["breached"]` and the session is minted anyway, so the client can prompt the user to change it. The key is ABSENT (not an empty array) when there is nothing to report; do not branch on its length without checking that it exists. Apps on the default `block` never see it — a breached password is refused with 400 `PASSWORD_BREACHED`.
Example: ["breached"]
mfa_enrollment_due_atstring · date-timePresent only when the app runs `mfa: "required"`, the user holds no enabled factor, and the account is still inside `mfa_grace_days` of its creation. The session IS minted; this is the deadline after which sign-in will start returning `mfa_enrollment_required` instead, so a client can prompt rather than block. Absent in every other case.
Example
Request
POST https://api.auth.productcraft.co/{app_slug}/v1/auth/accept-tenant-invite
Content-Type: application/json
{
"code": "tinv_9dK2mQ7pR4vXbN1sT6yZ0hLcJeW3fAgU",
"password": "CorrectHorseBatteryStaple",
"username": "john_doe",
"display_name": "Jane Doe"
}Response
{
"result": {},
"access_token": "string",
"refresh_token": "string",
"token_type": "Bearer",
"expires_in": 3600,
"password_warnings": [
"breached"
],
"mfa_enrollment_due_at": "2026-01-01T00:00:00.000Z"
}