Invites API Routes

An admin can invite new users to manage their team. This allows new users to authenticate as admins and perform admin functionalities.

These API routes allow admin users to manage invites.

GET /admin/invites#

List Invites

Retrieve a list of invites. The invites can be filtered by fields such as id. The invites can also be sorted or paginated.

Authentication: secret API key (HTTP Basic authorization), cookie session, JWT bearer token.

Query parameters

fieldsstringOptional
Comma-separated fields that should be included in the returned data. if a field is prefixed with + it will be added to the default fields, using - will remove it from the default fields. without prefix it will replace the entire default fields.
offsetnumberOptional
The number of items to skip when retrieving a list.
limitnumberOptional
Limit the number of items returned in the list.
orderstringOptional
The field to sort the data by. By default, the sort order is ascending. To change the order to descending, prefix the field name with -.
qstringOptional
Search term to apply on an invite's searchable properties.
idstring | string[]Optional
Filter by an invite's ID.
emailstring | string[]Optional
Filter by an invite's email.
created_atobjectOptional
Filter by the invite's creation date. Accepts the filter operators.
updated_atobjectOptional
Filter by the invite's update date. Accepts the filter operators.
deleted_atobjectOptional
Filter by the invite's deletion date. Accepts the filter operators.
$andobject[]Optional
Join query parameters with an AND condition. Each object's content is the same type as the expected query parameters.
$orobject[]Optional
Join query parameters with an OR condition. Each object's content is the same type as the expected query parameters.
with_deletedbooleanOptional
Whether to include deleted records in the result.

Request examples

Responses

200 OK

limitnumber
The maximum number of items retrieved.
offsetnumber
The number of items skipped before the returned items.
countnumber
The total number of items.
invitesobject[]
The list of invites.

400, 401, 404, 409, 422, 500: an error response is returned.


POST /admin/invites#

Create Invite

Create a invite.

Authentication: secret API key (HTTP Basic authorization), cookie session, JWT bearer token.

Query parameters

fieldsstringOptional
Comma-separated fields that should be included in the returned data. if a field is prefixed with + it will be added to the default fields, using - will remove it from the default fields. without prefix it will replace the entire default fields.

Request body (application/json)

emailstring
The email of the user to invite.
metadataobjectOptional
The invite's metadata. Can be custom data in key-value pairs.

Request examples

Responses

200 OK

inviteobject
The invite's details.

400, 401, 404, 409, 422, 500: an error response is returned.

Emitted events

  • invite.created: Emitted when invites are created. You can listen to this event to send an email to the invited users, for example.

POST /admin/invites/accept#

Accept Invite

Accept an invite and create a new user. Since the user isn't created yet, the JWT token used in the authorization header is retrieved from the /auth/user/emailpass/register API route (or a provider other than emailpass). The user can then authenticate using the /auth/user/emailpass API route.

Authentication: cookie session, JWT bearer token.

Query parameters

tokenstring
The invite's token.
fieldsstringOptional
Comma-separated fields that should be included in the returned data. If a field is prefixed with + it will be added to the default fields, using - will remove it from the default fields. Without prefix it will replace the entire default fields.

Request body (application/json)

emailstringOptional
The invite's email.
first_namestringOptional
The invited user's first name.
last_namestringOptional
The invited user's last name.

Request examples

Responses

200 OK

userobjectOptional
The user's details.
messagestringOptional
The error message.

400, 401, 404, 409, 422, 500: an error response is returned.

Emitted events

  • user.created: Emitted when users are created.
  • invite.accepted: Emitted when an invite is accepted.

GET /admin/invites/{id}#

Get an Invite

Retrieve an invite by its ID. You can expand the invite's relations or select the fields that should be returned.

Authentication: secret API key (HTTP Basic authorization), cookie session, JWT bearer token.

Path parameters

idstring
The invite's ID.

Query parameters

fieldsstringOptional
Comma-separated fields that should be included in the returned data. if a field is prefixed with + it will be added to the default fields, using - will remove it from the default fields. without prefix it will replace the entire default fields.

Request examples

Responses

200 OK

inviteobject
The invite's details.

400, 401, 404, 409, 422, 500: an error response is returned.


DELETE /admin/invites/{id}#

Delete Invite

Delete an invite.

Authentication: secret API key (HTTP Basic authorization), cookie session, JWT bearer token.

Path parameters

idstring
The invite's ID.

Request examples

Responses

200 OK

idstring
The invite's ID.
objectstring
The name of the deleted object.

Default: "invite"

deletedboolean
Whether the invite was deleted.

400, 401, 404, 409, 422, 500: an error response is returned.

Emitted events

  • invite.deleted: Emitted when invites are deleted.

POST /admin/invites/{id}/resend#

Refresh Invite Token

Refresh the token of an invite.

Authentication: secret API key (HTTP Basic authorization), cookie session, JWT bearer token.

Path parameters

idstring
The invite's ID.

Query parameters

fieldsstringOptional
Comma-separated fields that should be included in the returned data. if a field is prefixed with + it will be added to the default fields, using - will remove it from the default fields. without prefix it will replace the entire default fields.

Request examples

Responses

200 OK

inviteobject
The invite's details.

400, 401, 404, 409, 422, 500: an error response is returned.

Emitted events

  • invite.resent: Emitted when invites should be resent because their token was refreshed. You can listen to this event to send an email to the invited users, for example.
Found a problem with this page?Report Issue
Edited Nov 14·Edit this page