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+ 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.offsetnumberOptionallimitnumberOptionalorderstringOptional-.qstringOptionalidstring | string[]Optionalemailstring | string[]Optionalcreated_atobjectOptionalupdated_atobjectOptionaldeleted_atobjectOptional$andobject[]Optional$orobject[]Optionalwith_deletedbooleanOptionalRequest examples
Responses
200 OK
limitnumberoffsetnumbercountnumberinvitesobject[]The list of invites.
invitesobject[]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+ 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)
emailstringmetadataobjectOptionalRequest examples
Responses
200 OK
inviteobjectThe invite's details.
inviteobject400, 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
tokenstringfieldsstringOptional+ 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)
emailstringOptionalfirst_namestringOptionallast_namestringOptionalRequest examples
Responses
200 OK
userobjectOptionalThe user's details.
userobjectOptionalmessagestringOptional400, 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
idstringQuery parameters
fieldsstringOptional+ 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
inviteobjectThe invite's details.
inviteobject400, 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
idstringRequest examples
Responses
200 OK
idstringobjectstringDefault: "invite"
deletedboolean400, 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
idstringQuery parameters
fieldsstringOptional+ 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
inviteobjectThe invite's details.
inviteobject400, 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.