Invites

Invites allow users to join systems. Each invite has a unique code and can be configured with usage limits, expiry times, and temporary membership.

The invite model

Properties

  • Name
    code
    Type
    string
    Description

    The unique invite code.

  • Name
    system_id
    Type
    string
    Description

    The ID of the system this invite is for.

  • Name
    system
    Type
    System?
    Description

    The resolved system object, when included.

  • Name
    channel_id
    Type
    string?
    Description

    The channel this invite targets, if any.

  • Name
    inviter_id
    Type
    string
    Description

    The ID of the user who created this invite.

  • Name
    inviter
    Type
    User?
    Description

    The resolved inviter user object, when included.

  • Name
    uses
    Type
    integer
    Description

    Number of times this invite has been used.

  • Name
    max_uses
    Type
    integer
    Description

    Maximum number of uses. 0 = unlimited.

  • Name
    max_age
    Type
    integer
    Description

    Duration in seconds before the invite expires. 0 = never.

  • Name
    temporary
    Type
    boolean
    Description

    Whether the invite grants temporary membership.

  • Name
    created_at
    Type
    timestamp
    Description

    When the invite was created.

  • Name
    expires_at
    Type
    timestamp?
    Description

    When the invite expires, if it has a max_age.


GET/v1/invites/:code

Get an invite

Retrieve an invite by its code. Returns the invite with the resolved system and inviter.

Request

GET
/v1/invites/abc123
curl https://api.localuniverse.io/v1/invites/abc123 \
  -H "Authorization: Bearer {token}"

Response

{
  "code": "abc123",
  "system_id": "1344387816333352652",
  "system": {
    "id": "1344387816333352652",
    "name": "Local Universe",
    "slug": "localuniverse",
    "icon": "https://cdn.localuniverse.io/icons/lu.png",
    "member_count": 1024
  },
  "inviter_id": "1344387816333399999",
  "inviter": {
    "id": "1344387816333399999",
    "username": "tino"
  },
  "uses": 5,
  "max_uses": 10,
  "max_age": 86400,
  "temporary": false,
  "created_at": "2025-02-26T19:17:12.848375Z",
  "expires_at": "2025-02-27T19:17:12.848375Z"
}

POST/v1/invites/:code/accept

Accept an invite

Accept an invite and join the system. The authenticated user will be added as a member.

Request

POST
/v1/invites/abc123/accept
curl -X POST https://api.localuniverse.io/v1/invites/abc123/accept \
  -H "Authorization: Bearer {token}"

DELETE/v1/invites/:code

Delete an invite

Revoke an invite. Requires MANAGE_SYSTEM permission or being the invite creator.

Request

DELETE
/v1/invites/abc123
curl -X DELETE https://api.localuniverse.io/v1/invites/abc123 \
  -H "Authorization: Bearer {token}"

GET/v1/systems/:systemId/invites

List system invites

Returns all active invites for a system. See also Systems.

Request

GET
/v1/systems/1344387816333352652/invites
curl https://api.localuniverse.io/v1/systems/1344387816333352652/invites \
  -H "Authorization: Bearer {token}"

POST/v1/systems/:systemId/invites

Create a system invite

Create a new invite for a system. See also Systems.

Optional attributes

  • Name
    max_uses
    Type
    integer
    Description

    Maximum number of uses. 0 = unlimited.

  • Name
    max_age
    Type
    integer
    Description

    Duration in seconds. 0 = never expires.

  • Name
    temporary
    Type
    boolean
    Description

    Whether to grant temporary membership.

Request

POST
/v1/systems/1344387816333352652/invites
curl -X POST https://api.localuniverse.io/v1/systems/1344387816333352652/invites \
  -H "Authorization: Bearer {token}" \
  -H "Content-Type: application/json" \
  -d '{"max_uses": 10, "max_age": 86400}'

Was this page helpful?