Invitations Service API
API reference for managing organization invitations
The Invitations Service provides endpoints for creating, managing, and responding to organization invitations. It enables organization administrators to invite users to join their organization with specific roles.
Authentication
All endpoints require a valid Bearer token in the Authorization header.
Base URL
Endpoints
Create Invitation
Create a new invitation to join an organization.
Endpoint: POST /api/invitations/create
Query Parameters:
Parameter | Required | Description |
---|---|---|
org_id | Yes | Organization ID |
Request Body:
Field | Type | Required | Description |
---|---|---|---|
email | string | Yes | Email address of the person to invite |
role_id | string | Yes | Role ID to assign to the user upon acceptance |
message | string | No | Optional personal message to include in the invitation email |
Response:
Field | Type | Description |
---|---|---|
id | string (UUID) | Invitation ID |
email | string | Recipient’s email address |
status | string | Invitation status (“pending”, “accepted”, “expired”, “revoked”) |
role | object | Role information |
organization | object | Organization information |
token | string | Invitation token (used in acceptance links) |
created_at | string (datetime) | Creation timestamp |
expires_at | string (datetime) | Expiration timestamp |
List Invitations
Retrieve all invitations for an organization.
Endpoint: GET /api/invitations/list
Query Parameters:
Parameter | Required | Description |
---|---|---|
org_id | Yes | Organization ID |
status | No | Filter by invitation status (pending, accepted, expired, revoked) |
Get Invitation
Get details about a specific invitation.
Endpoint: GET /api/invitations/get
Query Parameters:
Parameter | Required | Description |
---|---|---|
invitation_id | Yes | Invitation ID |
Validate Invitation
Validate an invitation token (used before accepting an invitation).
Endpoint: GET /api/invitations/validate
Query Parameters:
Parameter | Required | Description |
---|---|---|
token | Yes | Invitation token |
Resend Invitation
Resend an invitation email.
Endpoint: POST /api/invitations/resend
Query Parameters:
Parameter | Required | Description |
---|---|---|
invitation_id | Yes | Invitation ID |
Revoke Invitation
Revoke a pending invitation.
Endpoint: DELETE /api/invitations/revoke
Query Parameters:
Parameter | Required | Description |
---|---|---|
invitation_id | Yes | Invitation ID |
Bulk Create Invitations
Create multiple invitations at once.
Endpoint: POST /api/invitations/bulk_create
Query Parameters:
Parameter | Required | Description |
---|---|---|
org_id | Yes | Organization ID |
Request Body:
Field | Type | Required | Description |
---|---|---|---|
invitations | array | Yes | Array of invitation objects (email, role_id) |
message | string | No | Optional message to include in all invitation emails |
Accept Invitation (Backend Process)
Note: This endpoint is not directly exposed, as invitation acceptance is handled through the authentication service using a token.
The flow for accepting an invitation is:
- User receives an invitation email with a link containing the invitation token
- User clicks the link, which takes them to a signup page
- User completes the signup form and submits it to the
/api/auth/signup_invite
endpoint - Upon successful account creation, the user is automatically added to the organization with the designated role
Error Responses
Status Code | Description |
---|---|
400 | Bad Request - Invalid input or validation error |
401 | Unauthorized - Invalid or missing token |
403 | Forbidden - Insufficient permissions (only admins can manage invitations) |
404 | Not Found - Invitation doesn’t exist |
409 | Conflict - User already exists or is already a member of the organization |
410 | Gone - Invitation has expired or been revoked |
500 | Internal Server Error - Server-side error |
Implementation Notes
- Invitations expire after 7 days by default
- When an invitation is resent, its expiration date is extended
- Users can only be invited to join an organization if they don’t already have an account or are not already members
- Only users with appropriate permissions (Admins and Owners) can create and manage invitations
- Invitation tokens are secure, one-time-use tokens that become invalid after acceptance
- Email notifications are sent automatically when invitations are created or resent
Was this page helpful?