Invite a user to an organization
POST
/organizations/{org_id}/invitations
const url = 'https://api.perstat.io/organizations/example/invitations';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"email":"example","role":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.perstat.io/organizations/example/invitations \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "email": "example", "role": "example" }'Creates a pending invitation for the given email and role, enforcing role assignment rules and the plan’s seat limit (402 when members plus open invitations exceed it). An invitation email is sent when possible; if delivery is unavailable or fails, the response contains the invite token so the link can be shared manually. Returns 409 if the user is already a member or an invitation already exists. Invitations are accepted through the web application, not through this API.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”org_id
required
string
Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
object
email
required
string
role
required
string
Examplegenerated
{ "email": "example", "role": "example"}Responses
Section titled “Responses”Media typeapplication/json
object
invitation
required
object
email
required
string
expires_at_unix
required
integer format: int64
id
required
Public-ID der Einladung (inv_…).
string
role
required
string
invite_token
Dev-Modus (kein SMTP): das einmalige Einladungs-Token, damit das Frontend
den Einladungs-Link selbst anzeigen kann. Mit Mailer wäre dies null und
der Link würde per E-Mail zugestellt.
string | null
Examplegenerated
{ "invitation": { "email": "example", "expires_at_unix": 1, "id": "example", "role": "example" }, "invite_token": "example"}Already a member or invite exists