Invites

Invites are used by users to join a guild or group DM, or to add a user to their friends list.

Temporary Invites

Temporary invites (indicated by the temporary field) grant non-permanent access to a guild. Upon accepting a temporary invite, the user is added to the guild and can interact with it unconditionally until all of their sessions are disconnected. If the user does not have an active session at the time of accepting the invite, they will be removed after the next time they disconnect.

Guest Invites

Guest invites (indicated by the flags field), similar to temporary invites, also grant non-permanent access to a guild. However, unlike temporary invites, upon accepting a guest invite, the user does not become a member of the guild. The session ID provided during acceptance is dispatched a Guild Create event containing only the channel the invite was for, and the user receives no other guild-specific events (except for Guild Delete when they are removed). Guest access only allows using a subset of endpoints required for interacting with voice channels, and access is removed after the user disconnects from the voice channel.

Invite Object

A code that when used, adds a user to a guild or group DM channel, or creates a relationship between two users.

Invite Structure
FieldTypeDescription
codestringThe invite code (unique ID)
typeintegerThe type of invite
channel?partial channel objectThe channel this invite is for; null for friend invites that did not have a DM channel created
guild_id?snowflakeThe ID of the guild this invite is for
guild?invite guild objectThe guild this invite is for
profile?guild profile objectThe profile of the guild this invite is for
inviter?partial user objectThe user who created the invite
flags?integerThe invite's flags
target_type?integerThe type of target for this guild invite
target_user?partial user objectThe user whose stream to display for this voice channel stream invite
target_application?partial application objectThe embedded application to open for this voice channel embedded application invite
roles? 5array[partial role object]The roles to grant to the invitee upon acceptance
approximate_member_count? 1integerApproximate count of total members in the guild or group DM
approximate_presence_count? 1integerApproximate count of non-offline members in the guild
expires_at?ISO8601 timestampThe expiry date of the invite, if it expires
guild_scheduled_event?guild scheduled event objectGuild scheduled event data, only included if guild_scheduled_event_id contains a valid guild scheduled event ID
new_member? 2booleanWhether the user is a new member of the guild
show_verification_form? 2booleanWhether the user should be shown the guild's member verification form
is_nickname_changeable? 3booleanWhether the @everyone role has the CHANGE_NICKNAME permission in the guild this invite is for
target_users_job_status? 4invite target users job objectThe status of the target users file processing job for the given invite

1 Only included when fetched from the Get Invite endpoint with with_counts set to true. Also included when fetched from the Accept Invite endpoint on non-previewable guilds.

2 Only included when fetched from the Accept Invite endpoint. Note that new_member is erroneously set to true for non-guild invites and is missing when accepting an invite to a non-previewable guild.

3 Only included when fetched from the Get Invite endpoint with with_permissions set to true.

4 Only included when fetched from the Get Guild Invites endpoint.

5 Partial role objects contain id, name, position, color, colors, icon, and unicode_emoji

Invite Type
ValueNameDescription
0GUILDJoins the user to a guild
1GROUP_DMJoins the user to a group DM
2FRIENDAdds the user as a friend to the inviter
Invite Target Type
ValueNameDescription
1STREAMThe invite is for a stream in a voice channel
2EMBEDDED_APPLICATIONThe invite is for an embedded application (activity) in a voice channel
3ROLE_SUBSCRIPTIONS 1The invite redirects to the role subscriptions page within a guild
4CREATOR_PAGE 1The invite originates from the creator page of a guild
5LOBBY 1The invite is for a lobby member

1 Invites with these target types are not returned in the Get Guild Invites and Get Channel Invites endpoints. They are also not deletable through Delete Invite.

Invite Flags
ValueNameDescription
1 << 0IS_GUEST_INVITEInvite grants one-time access to a voice channel in the guild
1 << 1IS_VIEWEDInvite has been viewed by any user (has been retrieved using Get Invite)
1 << 2IS_ENHANCEDUnknown
1 << 3IS_APPLICATION_BYPASSInvite bypasses guild join requests and adds the user directly to the guild with pending set to false
Example Invite Object
{
"type": 0,
"code": "jvuBeT38",
"inviter": {
"id": "852892297661906993",
"username": "alien",
"avatar": "05145cc5646fbcba277b6d5ea2030610",
"discriminator": "0",
"public_flags": 4194432,
"banner": null,
"accent_color": null,
"global_name": "Alien",
"avatar_decoration_data": null,
"primary_guild": null
},
"expires_at": "2023-07-22T18:30:11+00:00",
"guild": {
"id": "1046920999469330512",
"name": "Alien Network",
"splash": "b40e61f7730b8781b9a551964570e0cc",
"banner": "a_98d07f130569f17e8352df80c3a2bc2b",
"description": "Where the 👽s 👽 and sometimes very 👽 things happen 😨.",
"icon": "66b0f4d96c145970fa9d96ada8afadf3",
"features": [],
"verification_level": 2,
"vanity_url_code": "alien",
"premium_subscription_count": 14,
"nsfw": false,
"nsfw_level": 0
},
"guild_id": "1046920999469330512",
"channel": {
"id": "1057241425793798144",
"type": 2,
"name": "alien noises"
},
"target_type": 2,
"target_application": {
"id": "880218394199220334",
"name": "Watch Together",
"icon": "ec48acbad4c32efab4275cb9f3ca3a58",
"description": "Create and watch a playlist of YouTube videos with your friends. Your choice to share the remote or not. ",
"type": null,
"is_monetized": false,
"is_verified": false,
"is_discoverable": false,
"cover_image": "3cc9446876ae9eec6e06ff565703c292",
"bot": {
"id": "880218394199220334",
"username": "Watch Together",
"avatar": "fe2b7fa334817b0346d57416ad75e93b",
"discriminator": "5319",
"public_flags": 0,
"bot": true,
"banner": null,
"accent_color": null,
"global_name": null,
"avatar_decoration_data": null,
"primary_guild": null
},
"summary": "",
"bot_public": false,
"bot_require_code_grant": false,
"terms_of_service_url": "https://discord.com/terms",
"privacy_policy_url": "https://discord.com/privacy",
"verify_key": "e2aaf50fbe2fd9d025ac669035f5efb89099931690fba9dc28efb7eaade7f96d",
"flags": 1179648,
"max_participants": -1,
"tags": ["Video Player", "Watch"],
"hook": true,
"storefront_available": false,
"embedded_activity_config": {
"activity_preview_video_asset_id": "1104184163201990836",
"supported_platforms": ["web", "ios", "android"],
"default_orientation_lock_state": 2,
"tablet_default_orientation_lock_state": 1,
"requires_age_gate": false,
"legacy_responsive_aspect_ratio": false,
"premium_tier_requirement": null,
"free_period_starts_at": null,
"free_period_ends_at": null,
"client_platform_config": {
"ios": { "label_type": 0, "label_until": null, "release_phase": "global_launch" },
"android": { "label_type": 0, "label_until": null, "release_phase": "global_launch" },
"web": { "label_type": 0, "label_until": null, "release_phase": "global_launch" }
},
"shelf_rank": 3,
"has_csp_exception": false,
"displays_advertisements": false
}
},
"approximate_member_count": 100,
"approximate_presence_count": 99,
"is_nickname_changeable": true
}

Invite Metadata Object

Extra information about an invite, will extend the invite object.

Invite Metadata Structure
FieldTypeDescription
uses? 1integerNumber of times this invite has been used
max_uses? 1integerMax number of times this invite can be used
max_age?integerDuration (in seconds) after which the invite expires (default 0)
temporary? 2booleanWhether this invite only grants temporary membership (default false for unsupported invite types)
created_atISO8601 timestampWhen this invite was created

1 This information is not tracked or returned for group DM invites. However, they always have a max_uses of 0.

2 Temporary invites are only supported for guilds.

Example Invite with Metadata Object
{
"type": 0,
"code": "jvuBeT38",
"inviter": {
"id": "852892297661906993",
"username": "alien",
"avatar": "05145cc5646fbcba277b6d5ea2030610",
"discriminator": "0",
"public_flags": 4194432,
"banner": null,
"accent_color": null,
"global_name": "Alien",
"avatar_decoration_data": null,
"primary_guild": null
},
"max_age": 604800,
"created_at": "2023-07-15T18:30:11.047000+00:00",
"expires_at": "2023-07-22T18:30:11+00:00",
"guild": {
"id": "1046920999469330512",
"name": "Alien Network",
"splash": "b40e61f7730b8781b9a551964570e0cc",
"banner": "a_98d07f130569f17e8352df80c3a2bc2b",
"description": "Where the 👽s 👽 and sometimes very 👽 things happen 😨.",
"icon": "66b0f4d96c145970fa9d96ada8afadf3",
"features": [],
"verification_level": 2,
"vanity_url_code": "alien",
"nsfw_level": 0,
"nsfw": false,
"premium_subscription_count": 14,
"premium_tier": 3
},
"guild_id": "1046920999469330512",
"channel": {
"id": "1057241425793798144",
"type": 2,
"name": "alien noises"
},
"uses": 0,
"max_uses": 0,
"temporary": false
}

Invite Guild Object

The guild an invite is for.

Invite Guild Structure
FieldTypeDescription
idsnowflakeThe ID of the guild
namestringThe name of the guild (2-100 characters)
icon?stringThe guild's icon hash
description?stringThe description for the guild (max 300 characters)
banner?stringThe guild's banner hash
splash?stringThe guild's splash hash
verification_levelintegerThe verification level required for the guild
featuresarray[string]Enabled guild features
vanity_url_code?stringThe guild's vanity invite code
premium_subscription_count?integerThe number of premium subscriptions (boosts) the guild currently has
premium_tierintegerThe guild's premium tier (boost level)
nsfw (deprecated)booleanWhether the guild is considered NSFW (EXPLICIT or AGE_RESTRICTED)
nsfw_levelintegerThe guild's NSFW level

Invite Target Users Job Object

The status of the target users file processing job for an invite.

Invite Target Users Job Structure
FieldTypeDescription
statusintegerThe status of the job processing the target users
total_usersintegerThe total number of user IDs in the target users file
processed_usersintegerThe number of user IDs processed so far
created_at?ISO8601 timestampWhen the job was created
completed_at?ISO8601 timestampWhen the job was completed
error_message?stringAn error message, if the job failed
Invite Target Users Job Status
ValueNameDescription
0UNSPECIFIEDJob status is unspecified
1PROCESSINGJob is currently being processed
2COMPLETEDJob has been completed
3FAILEDJob has failed (see error_message)

Endpoints

Get Invite

GET/invites/{invite.code}

Returns an invite object for the given code.

Query String Params
FieldTypeDescription
with_counts?booleanWhether the invite should contain approximate member counts (and partial recipients for group DM invites) (default false)
with_permissions?booleanWhether the invite should contain permission-related fields (default false)
guild_scheduled_event_id?snowflakeThe guild scheduled event to include with the invite

Get Invite Friend Members

GET/invites/{invite.code}/friend-members

Returns the user IDs of friends in the target guild. Always returns an empty array for group DMs and friend invites.

Response Body
FieldTypeDescription
friend_member_idsarray[snowflake]User IDs of friends in the target guild

Get Invite Target Users

GET/invites/{invite.code}/target-users

Returns the IDs of the users allowed to see and accept the given invite. Invite must have a target users file associated with it. Requires the MANAGE_GUILD or VIEW_AUDIT_LOG permission if the requestor is not the inviter. Return a CSV file with the header user_id and each user ID passed to invite create on its own line.

Update Invite Target Users

PUT/invites/{invite.code}/target-users

Replaces the target users file associated with the given invite. Processing is done asynchronously. Invite must have been created with a target users file. Requires the MANAGE_GUILD permission if the requestor is not the inviter. Returns a 204 empty response on success.

Form Params
FieldTypeDescription
target_users_file 1file contentsA CSV file with a single column of user IDs to restrict the invite to

1 See Uploading Files for details.

Get Invite Target Users Job Status

GET/invites/{invite.code}/target-users/job-status

Returns an invite target users job object for the given invite. Invite must have a target users file associated with it. Requires the MANAGE_GUILD or VIEW_AUDIT_LOG permission if the requestor is not the inviter.

Accept Invite

POST/invites/{invite.code}

Accepts an invite to a guild, group DM, or DM. Returns an invite object on success. May fire a Guild Create, Guild Member Add, Guild Join Request Create, Channel Create, and/or Relationship Add Gateway event.

JSON Params
FieldTypeDescription
session_id?stringThe session ID that is accepting the invite, required for guest invites

Delete Invite

DELETE/invites/{invite.code}

Deletes an invite. Requires the MANAGE_CHANNELS permission on the channel this invite belongs to, or MANAGE_GUILD to remove any invite across the guild, if the invite is to a guild. Returns an invite object on success. May fire an Invite Delete Gateway event.

Get Guild Invites

GET/guilds/{guild.id}/invites

Returns a list of invite objects for the guild. Requires the MANAGE_GUILD or VIEW_AUDIT_LOG permission. Invite metadata is included if the user has the MANAGE_GUILD permission.

Get Channel Invites

GET/channels/{channel.id}/invites

Returns a list of invite objects (with invite metadata) for the channel. Only usable for guild channels and group DMs. Requires the MANAGE_CHANNELS permission if the channel is in a guild.

Create Channel Invite

POST/channels/{channel.id}/invites

Creates a new invite object for the channel. Only usable for guild channels and group DMs. Requires the CREATE_INSTANT_INVITE permission if the channel is in a guild. Returns an invite object (with invite metadata). Fires an Invite Create Gateway event if the channel is in a guild.

JSON/Form Params
FieldTypeDescription
flags? 1integerThe invite's flags (only IS_GUEST_INVITE and IS_APPLICATION_BYPASS can be set)
max_age? 2integerNumber of seconds before expiry, or 0 for never (0-5184000, default 86400)
max_uses?integerMax number of uses or 0 for unlimited (0-100, default 0)
temporary?booleanWhether the invite only grants temporary membership (default false)
unique?booleanWhether to try to reuse a similar invite (useful for creating many unique one time use invites, default false)
target_type?integerThe type of target for the invite
target_user_id?snowflakeThe ID of the user whose stream to display for the invite, required if target_type is STREAM; the user must be streaming in the channel
target_application_id?snowflakeThe ID of the embedded application to open for the invite, required if target_type is EMBEDDED_APPLICATION; the application must have the EMBEDDED flag
target_users_file? 3file contentsA CSV file with a single column of user IDs to restrict the invite to
role_ids? 4array[snowflake]The IDs of the roles to grant to the invitee upon acceptance

1 Creating an invite with the APPLICATION_BYPASS flag requires the KICK_MEMBERS permission.

2 For group DMs, max_age is the only supported parameter, and it accepts a value from 1 to 604800 (7 days).

3 Processing is done asynchronously. See Uploading Files for details.

4 Requires the MANAGE_ROLES permission. Cannot grant roles that are equal to or higher than the creator's highest role.

Get User Invites

GET/users/@me/invites

Returns a list of friend invite objects (with invite metadata) for the current user.

Create User Invite

POST/users/@me/invites

Creates a new friend invite. Returns a friend invite object (with invite metadata) on success.

JSON Params
FieldTypeDescription
code?stringThe pre-generated friend invite code to create an invite from

Revoke User Invites

DELETE/users/@me/invites

Revokes all of the current user's friend invites. Returns a list of revoked friend invite objects (with invite metadata) on success.