/api/auth/invites

View all invites or create an invite code.

Info

This endpoint requires authentication.

Info

This endpoint requires administrator priviliges or higher.

Path Parameters

NameTypeDescription
idstringThe unique ID of the invite.

GET
Request

Response

Status: 200 OK

Content-Type: application/json

An array of the Invite object.

Example

[
{
"id": "cmb7c5d3n0002vcatximfhrf0",
"createdAt": "2025-05-28T02:38:04.691Z",
"updatedAt": "2025-05-28T02:38:04.691Z",
"expiresAt": null,
"code": "falpjX",
"uses": 0,
"maxUses": null,
"inviterId": "cmb6042f500029kenox2u8npu",
"inviter": {
"username": "admin",
"id": "cmb6042f500029kenox2u8npu",
"role": "SUPERADMIN"
}
}
]

POST
Request

Body

Content-Type: application/json

PropertyTypeDescription
expiresAtstringRequired. Expiry time for the invite (ISO string or 'never').
maxUsesnumber?Maximum allowed uses for the invite.

Example

An invite that expires on June 1, 2025, and can be used a maximum of 10 times:

{
"expiresAt": "2025-06-01T00:00:00Z",
"maxUses": 10
}

Response

Status: 200 OK

Content-Type: application/json

Returns the newly created Invite object.

Example

{
"id": "cmb7c5d3n0002vcatximfhrf0",
"createdAt": "2025-05-28T02:38:04.691Z",
"updatedAt": "2025-05-28T02:38:04.691Z",
"expiresAt": "2025-06-01T00:00:00Z",
"code": "falpjX",
"uses": 0,
"maxUses": 10,
"inviterId": "cmb6042f500029kenox2u8npu",
"inviter": {
"username": "admin",
"id": "cmb6042f500029kenox2u8npu",
"role": "SUPERADMIN"
}
}

Error Responses

  • 400 Bad Request
    • If the expiresAt is not a valid ISO string.
    • If maxUses is provided but not a number.


Last updated: 5/28/2025
Edit this page on GitHub