Create organization invitation
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.
-
inviterId string | null
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.
-
organizationRoleIds array[string]
The IDs of the organization roles to assign to the user when they accept the invitation.
messagePayload object | boolean(false) Required
The message payload for the "OrganizationInvitation" template to use when sending the invitation via email. If it is
false
, the invitation will not be sent via email.One of: Default value is
false
.
Responses
-
201 application/json
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
-
No email connector is configured for the tenant.
curl \
-X POST https://[tenant_id].logto.app/api/organization-invitations \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"inviterId":"string","invitee":"hello@example.com","organizationId":"string","expiresAt":42.0,"organizationRoleIds":["string"],"messagePayload":{"code":"string","link":"string","key":"string"}}'
{
"inviterId": "string",
"invitee": "hello@example.com",
"organizationId": "string",
"expiresAt": 42.0,
"organizationRoleIds": [
"string"
],
"messagePayload": {
"code": "string",
"link": "string",
"key": "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"
}
]
}