Invite a user to an organization
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, and 422 (disposable_email) for a disposable email address. Invitations are accepted through the web application, not through this API. Accepts API keys with the org:write scope, subject to current role and resource grants.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Request Bodyrequired
Section titled “Request Bodyrequired”object
Examplegenerated
{ "email": "example", "role": "example"}Responses
Section titled “Responses”Resource created. The response body contains the created resource.
object
object
Public-ID der Einladung (inv_…).
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.
Examplegenerated
{ "invitation": { "email": "example", "expires_at_unix": 1, "id": "example", "role": "example" }, "invite_token": "example"}The request is invalid. Check the supplied fields and values.
Authentication is missing or invalid.
The authenticated caller does not have permission to perform this operation.
Already a member or invite exists
Disposable email address (disposable_email)