Overview
This article provides steps on adjusting the expiration period for an organization member’s invitation link using the Management API and provides the default expiration period.
Applies To
- Organizations
- Invitation
Solution
It is possible to trigger the member invitation with the Management API with a custom expiration period:
"method": "POST",
"url": "https://YOUR_AUTH0_DOMAIN/api/v2/organizations/ORG_ID/invitations",
Send this field in the request body:
ttl_sec
The number of seconds before the invitation expires. If unspecified or set to 0, defaults to 604800 seconds (7 days). Maximum of 2592000 seconds (30 days).
Example (sends a 10-second expiration for testing):
{
"inviter": {
"name": "YOUR_ORGANIZATION_NAME"
},
"invitee": {
"email": "user@email.com"
},
"client_id": "YOUR_CLIENT_ID",
"ttl_sec": 10,
"send_invitation_email": true
}
Response body:
{
"id": "redacted [string]",
"client_id": "redacted [string]",
"inviter": {
"name": "redacted [string]"
},
"invitee": {
"email": "user@email.com"
},
"invitation_url": "https://CONFIGURED_DEFAULT_LOGIN_URL/?invitation=REDACTED&organization=REDACTED&organization_name=REDACTED",
"ticket_id": ""redacted [string]",
"created_at": "2024-12-04T11:32:50.994Z",
"expires_at": "2024-12-04T11:33:00.994Z",
"organization_id": ""redacted [string]"
}
The email the user receives, contains a link to the same invitation_url in the response above.
The route in the application must accept the invitation
and organization
parameters in the query string, and then call the Auth0 Authentication API Authorization endpoint with both parameters.
Related References
API documentation: