Create organization invitation

POST /api/organization-invitations

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.

application/json

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.

  • invitee string(email) Required

    The email address of the user to invite to join the organization.

  • organizationId string Required

    The ID of the organization to invite the user to join.

    Minimum length is 1, maximum length is 21.

  • expiresAt number Required

    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
    One of:

    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.

    Default value is false.

Responses

  • 201

    The organization invitation was created successfully.

  • 400

    The organization invitation could not be created. This can happen if the input is invalid or if the expiration date is in the past.

  • 401

    Unauthorized

  • 403

    Forbidden

  • 422

    Unprocessable Content

  • 501

    No email connector is configured for the tenant.

POST /api/organization-invitations
curl \
 -X POST https://[tenant_id].logto.app/api/organization-invitations \
 -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"}}'
Request example
{
  "inviterId": "string",
  "invitee": "hello@example.com",
  "organizationId": "string",
  "expiresAt": 42.0,
  "organizationRoleIds": [
    "string"
  ],
  "messagePayload": {
    "code": "string",
    "link": "string",
    "key": "string"
  }
}