Invite a member
Identity module
POST/invitesinvites.create
Invites an email to the caller's organization with a role the inviter may grant and an expiry of 1 hour to 30 days, through `app.invite_member`. Replaces any pending invite for the same email. Refused with 422 for a role above the inviter's band, a capability the inviter does not hold, an out-of-range expiry or a self-invite. The token is returned once. Requires `Idempotency-Key`; a replay returns the original response. A rule that refuses the request returns 422 with `refusal` and `reason`.
- Requires the capability org.members.invite.
- OAuth scopes: org.
- Send an Idempotency-Key header. A replay with the same key returns the original response.
- Error statuses: 400, 401, 409, 422, 429. Errors are RFC 9457 problem details.
Request body: InviteMemberRequest
| Field | Type | Required | Description |
|---|---|---|---|
| string (email) | Yes | Invitee email. | |
| role_id | string (uuid) | Yes | Identifier of the role offered, at or below the inviter's band. |
| valid_for_hours | integer | No | Hours until the invite expires, from 1 to 720. Default 336 (14 days).Constraints: range 1 to 720 |
{
"email": "alex.rivera@northwindlive.example",
"role_id": "0192f1e2-7c3a-7b4d-9e8f-1a2b3c4d5e6f",
"valid_for_hours": 336
}Response 201: InviteMemberResult
| Field | Type | Required | Description |
|---|---|---|---|
| invite_id | string (uuid) | Yes | Identifier of the invite. |
| invite_token | string | Yes | Invite token from the invitation email. Sent in the body, never in a URL.Constraints: length 1 to any |
{
"invite_id": "0192f1e2-7c3a-7b4d-9e8f-1a2b3c4d5e6f",
"invite_token": "xinv_3f9a1c0d7e2b4a6f8c1d0e9b7a5c3f1e"
}Code samples
curl -X POST "$XOS_BASE_URL/invites" \
-H "Authorization: Bearer $XOS_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{"email":"alex.rivera@northwindlive.example","role_id":"0192f1e2-7c3a-7b4d-9e8f-1a2b3c4d5e6f","valid_for_hours":336}'const { data } = await xos.invites.create({
"email": "alex.rivera@northwindlive.example",
"role_id": "0192f1e2-7c3a-7b4d-9e8f-1a2b3c4d5e6f",
"valid_for_hours": 336
});response = xos.invites.create({"email": "alex.rivera@northwindlive.example", "role_id": "0192f1e2-7c3a-7b4d-9e8f-1a2b3c4d5e6f", "valid_for_hours": 336})xos invites create --data '{"email":"alex.rivera@northwindlive.example","role_id":"0192f1e2-7c3a-7b4d-9e8f-1a2b3c4d5e6f","valid_for_hours":336}'