Create an organization invitation and optionally send it via email. The tenant should have an email connector configured if you want to send the invitation via email at this point.
Body
Required
The organization invitation to create.
-
The ID of the user who is inviting the user to join the organization.
Maximum length is
21. -
The email address of the user to invite to join the organization.
-
The ID of the organization to invite the user to join.
Minimum length is
1, maximum length is21. -
The epoch time in milliseconds when the invitation expires.
-
The IDs of the organization roles to assign to the user when they accept the invitation.
Responses
-
The organization invitation was created successfully.
-
The organization invitation could not be created. This can happen if the input is invalid or if the expiration date is in the past.
-
Unauthorized
-
Forbidden
-
Unprocessable Content
-
Too Many Requests
-
No email connector is configured for the tenant.
curl \
--request POST 'https://[tenant_id].logto.app/api/organization-invitations' \
--header "Authorization: Bearer $ACCESS_TOKEN" \
--header "Content-Type: application/json" \
--data '{"inviterId":"string","invitee":"hello@example.com","organizationId":"string","expiresAt":42.0,"organizationRoleIds":["string"],"messagePayload":{"code":"string","link":"string","locale":"string","uiLocales":"string"}}'
{
"inviterId": "string",
"invitee": "hello@example.com",
"organizationId": "string",
"expiresAt": 42.0,
"organizationRoleIds": [
"string"
],
"messagePayload": {
"code": "string",
"link": "string",
"locale": "string",
"uiLocales": "string"
}
}
{
"tenantId": "string",
"id": "string",
"inviterId": "string",
"invitee": "string",
"acceptedUserId": "string",
"organizationId": "string",
"status": "Pending",
"createdAt": 42.0,
"updatedAt": 42.0,
"expiresAt": 42.0,
"organizationRoles": [
{
"id": "string",
"name": "string"
}
]
}