Invite Resource

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
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
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
stage_instance?invite stage instance objectStage instance data if there is a public stage instance in the stage channel this invite is for
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 joined guild's member verification form

1 Only included when fetched from the Get Invite endpoint with with_counts set to true.

2 Only included when fetched from the Accept Invite endpoint. Note that this is erroneously set to true for non-guild invites.

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

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 << 0GUESTThe invite grants one-time access to a voice channel in the guild
1 << 1VIEWEDThe invite has been viewed by any user (has been retrieved using Get Invite)
1 << 2ENHANCEDUnknown
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,
"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
}

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",
"premium_subscription_count": 14,
"nsfw": false,
"nsfw_level": 0
},
"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
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
nsfw (deprecated)booleanWhether the guild is considered NSFW (EXPLICIT or AGE_RESTRICTED)
nsfw_levelintegerThe guild's NSFW level

Invite Stage Instance Object

A stage instance attached to an invite.

Invite Stage Instance Structure
FieldTypeDescription
membersarray[partial guild member object]The members speaking in the stage
participant_countintegerThe number of users in the stage
speaker_countintegerThe number of users speaking in the stage
topicstringThe topic of the stage instance (1-120 characters)
Example Invite Stage Instance
{
"topic": "The debate is over: diet is better than regular",
"participant_count": 200,
"speaker_count": 5,
"members": [
{
"avatar": null,
"banner": null,
"communication_disabled_until": null,
"unusual_dm_activity_until": null,
"flags": 0,
"joined_at": "2022-10-11T12:31:03.882000+00:00",
"nick": ":~]",
"pending": false,
"premium_since": null,
"roles": ["1040221495437299782"],
"user": {
"id": "863406480111566858",
"username": "leaduck",
"global_name": "LeaDuck",
"avatar": "bb450561133bac3da5c7e201db40af6c",
"discriminator": "0",
"public_flags": 256,
"avatar_decoration_data": null,
"primary_guild": null
}
}
]
}

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)
guild_scheduled_event_id?snowflakeThe guild scheduled event to include with the invite

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 (with invite metadata) for the guild. Requires 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 Params
FieldTypeDescription
flags?integerThe invite's flags (only GUEST can be set)
max_age? 1integerNumber of seconds before expiry, or 0 for never (0-604800, default 86400)
max_uses?integerMax number of uses or 0 for unlimited (0-100, default 0)
temporary?booleanWhether this 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)
validate??stringThe invite code to validate and attempt to reuse; if nonexistant, a new invite will be created as usual
target_type?integerThe type of target for this voice channel invite
target_user_id?snowflakeThe ID of the user whose stream to display for this 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 this invite, required if target_type is EMBEDDED_APPLICATION, the application must have the EMBEDDED flag

1 For group DMs, only max_age is supported, and it does not support 0.

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.