Accept Invitation
Accept an organization invitation for the current user.
Description
The Accept Invitation endpoint allows an authenticated user to accept an organization invitation and join the organization. Upon acceptance, the system automatically creates an organization membership, assigns the specified role, and grants access to the associated workspace. This endpoint completes the invitation workflow and enables the user to access organization resources.
This endpoint is part of the Invitations API and is the final step in the invitation acceptance process. Users must first view the invitation details to understand what they're accepting, then authenticate and call this endpoint to complete the process.
Use Cases
- Join Organization: Accept invitations to join organizations and gain access to resources
- Team Collaboration: Join teams and workspaces through invitation links
- Role Assignment: Accept invitations with specific role assignments
- Access Management: Gain access to organization resources through invitation acceptance
Workflow Context
This endpoint is used in the following invitation acceptance workflow:
- User receives invitation email with invitation token
- User views invitation details to review organization, workspace, and role
- User authenticates or creates an account
- User calls this endpoint to accept the invitation
- System creates membership, assigns role, and grants workspace access
- User can now access organization resources
Prerequisites
- User must be authenticated with a valid access token
- Valid invitation token (obtained from invitation email or Get Invitation endpoint)
- Invitation must be valid, not expired, and not already accepted
- User email must match the invitation email (or system must allow email changes)
Quick Navigation
Endpoint
POST /api/v1/invitations/{invitation_token}/accept
Headers
| Header | Required | Description |
|---|---|---|
Authorization | Yes | Bearer <access_token> |
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
invitation_token | string | Yes | Unique invitation token received via email or obtained from the Get Invitation endpoint. The token must be valid and not expired. |
Response
Success (200)
{
"success": true,
"data": {
"organization": {
"id": 1,
"name": "Acme Corp"
},
"workspace": {
"id": 1,
"name": "Main Workspace"
},
"membership": {
"id": 1,
"is_admin": false
},
"role": {
"id": 2,
"name": "Developer"
},
"message": "Invitation accepted successfully."
},
"message": "Invitation accepted successfully."
}
Features
- Automatic Membership Creation: Creates organization membership and workspace access automatically
- Role Assignment: Assigns the role specified in the invitation to the user
- Invitation Completion: Marks the invitation as accepted and prevents duplicate acceptance
- Comprehensive Response: Returns organization, workspace, membership, and role details
- Audit Logging: Records invitation acceptance events for security monitoring and compliance
- Email Validation: Ensures user email matches invitation email (or handles email changes if allowed)
Response Fields
| Field | Type | Description |
|---|---|---|
organization | object | Organization details including ID and name the user has joined |
workspace | object | Workspace details including ID and name where the user has been granted access |
membership | object | Membership details including ID and admin status |
membership.is_admin | boolean | Whether the user has administrative privileges in the organization |
role | object | Role details including ID and name assigned to the user |
Important Notes
- One-Time Use: Each invitation can only be accepted once. After acceptance, the invitation token becomes invalid.
- Email Matching: The authenticated user's email must match the invitation email, unless the system allows email changes.
- Immediate Access: Upon successful acceptance, the user immediately gains access to the organization and workspace.
- Role Permissions: The user's permissions are determined by the role assigned in the invitation.
Error Handling
Common error scenarios include:
- Invalid or expired invitation token
- Invitation already accepted
- User email mismatch
- Authentication failure
For more information on error handling, see Error Handling.
Related Endpoints
- Get Invitation - View invitation details before accepting (prerequisite)
- List Invitations - List invitations (requires permissions)
- Login - Authenticate to accept invitation (prerequisite)
- Invite Member - Create invitations (admin operation)
See Also
- Invitations API Overview - Complete guide to invitation management workflows
- Organizations API Overview - Organization and member management
- Roles & Permissions API - Understanding roles and permissions
- Authentication Concepts - Understanding authentication and token management
- Error Handling - Understanding API error responses