Socket
Socket
Sign inDemoInstall

mapih

Package Overview
Dependencies
Maintainers
0
Versions
107
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mapih

Complete collection of Discord API endpoint handlers.


Version published
Weekly downloads
14
decreased by-72.55%
Maintainers
0
Weekly downloads
 
Created
Source

view on npm npm module downloads

Mapih

Comprehensive collection of Discord, OpenAI, Anthropic, Spotify, YouTube, Twitter, Slack, Imgur, DropBox, Box and various Google API endpoint handlers

Discord is the only completed set of handlers, the rest are still in early development


Authentication

Choose one of the following options to authenticate:

Option 1: Using Environment Variablese

If you are using OnSocket, use this file to get the valid keys but add them to OnSocket's environment variables on the website itself.

Rename the provided .env.example file at the root of your project to .env and fill in any tokens/keys you wish to use.

Option 2: Using Initialization Function
const mapih = require('mapih');

// Minimum requirement if using this method
mapih.initialize({ discord: 'bot_token' });

// All possible properties
mapih.initialize({
  discord: 'bot_token',
  openai: 'sk-1p7NKtCpA0sG7XLdT3L7EqW9GFefX',
  spotify: {
    client_id: 'cc4287d9Cm4692a9f681d07d9boqji83',
    client_secret: '898Nb8f7b09tMnb2lkj3c55443ddmn0ze',
    redirect_uri: 'http:localhost:8001/spotify',
    scope: 'user-read-email user-read-private'
  },
  google: {
    api_key: 'AISlkuhyA4q4L9m0c3I09maoOYTN0wuyWdA',
    client_id: '2164170085-9r94msc46elo.apps.googleusercontent.com',
    client_secret: 'GOSLPM-sPn88Kn6GWk90Nh0uk_MNim7698By4',
    redirect_uri: 'http://localhost:8001/youtube'
  },
  slack: {
    user: '6942854604069-6272480346098-6284925009575-6901309',
    bot: '6942854604069-6262140883098-Vt6RKehxmTj4Luvvy',
    client_id: '6942854604069.624286609478',
    client_secret: '4e4998dh94rl846bdsdfegfb0f12',
    redirect_uri: 'http:localhost:8001/slack',
    user_scope: 'admin users:read.email',
    bot_scope: 'users:read.email channels:read'
  },
  dropbox: {
    basic_token: 'N09asdfGlzZzB9P63465efasNWxAvfpk3dQ',
    access_token: 'sl.BsobToktTBbsdf235aiihH7j60T_4T',
    client_id: '7cxvzmptyug7ymc9',
    client_secret: 'easdf8980k6csdf5y7u',
    redirect_uri: 'http:localhost:8001/dropbox'
  },
  box: {
    client_id: '3sdfgi8j90fpl8q25809sd0',
    client_secret: 'Jsdf6BB4UErgS2chrg4365sdfBXS',
    redirect_uri: 'http:localhost:8001/box'
  },
});

Basic usage

(async() => {

  await mapih.discord.channels.messages.create({
    channel_id: '774133713733812275',
    content: 'hello'
  });

})();

Table of Contents

| Discord | Slack | Spotify | YouTube | Dropbox | Box | Utils |

Discord Methods

Applications     ◦ getMe     ◦ updateMe     ◦ appRoleConnectionMeta     ◦ updateAppRoleConnectionMeta     ◦ commands         ‣ retrieve         ‣ getAll         ‣ create         ‣ update         ‣ destroy         ‣ bulkOverwrite         ‣ retrievePermissions         ‣ getAllPermissions         ‣ updatePermissions     ◦ entitlements         ‣ getAll         ‣ create         ‣ destroy     ◦ skus         ‣ getAll Audit Log     ◦ retrieve Auto Moderation     ◦ retrieveRule     ◦ getAllRules     ◦ createRule     ◦ updateRule     ◦ destroyRule Channels     ◦ retrieve     ◦ update     ◦ destroy     ◦ updatePermissions     ◦ deletePermissions     ◦ getinvites     ◦ inviteCreate     ◦ typingCreate     ◦ followAnnouncementChannel     ◦ groupDMadd     ◦ groupDMremove     ◦ messages         ‣ retrieve         ‣ getAll         ‣ create         ‣ update         ‣ destroy         ‣ bulkDelete         ‣ crosspost         ‣ pin         ‣ unpin         ‣ getPinned     ◦ threads         ‣ forumThreadCreate         ‣ createFromMessage         ‣ createWithoutMessage         ‣ join         ‣ leave         ‣ addMember         ‣ removeMember         ‣ retrieveMember         ‣ getAllMembers         ‣ getAllPublicArchived         ‣ getAllPrivateArchived         ‣ getAllJoinedPrivateArchived     ◦ reactions         ‣ create         ‣ deleteOwn         ‣ deleteUser         ‣ deleteAll         ‣ deleteAllEmoji         ‣ getUsers Guilds     ◦ create     ◦ update     ◦ destroy     ◦ retrieve     ◦ destroy     ◦ getPreview     ◦ retrieve     ◦ getAll     ◦ create     ◦ destroy     ◦ getInvites     ◦ updateMFAlevel     ◦ getPruneCount     ◦ beginPrune     ◦ getVoiceRegions     ◦ getAllIntegrations     ◦ destroyIntegration     ◦ retrieveWidget     ◦ retrieveWidgetImage     ◦ retrieveWidgetSettings     ◦ updateWidget     ◦ retrieveVanityURL     ◦ retrieveWelcomeScreen     ◦ updateWelcomeScreen     ◦ retrieveOnboarding     ◦ updateOnboarding     ◦ newMemberWelcome     ◦ channels         ‣ getAll         ‣ create         ‣ updatePositions     ◦ members         ‣ retrieve         ‣ getAll         ‣ search         ‣ remove         ‣ update         ‣ updateCurrent         ‣ addRole         ‣ removeRole         ‣ getPermissionNames         ‣ timeout     ◦ roles         ‣ retrieve         ‣ getAll         ‣ create         ‣ update         ‣ destroy         ‣ updatePositions     ◦ emojis         ‣ retrieve         ‣ getAll         ‣ create         ‣ update         ‣ destroy     ◦ stickers         ‣ retrieve         ‣ nitroPacks         ‣ getAll         ‣ retrieveGuild         ‣ create         ‣ update         ‣ destroy     ◦ events         ‣ retrieve         ‣ getAll         ‣ getUsers         ‣ create         ‣ update         ‣ destroy     ◦ templates         ‣ retrieve         ‣ getAll         ‣ create         ‣ createGuild         ‣ sync         ‣ update         ‣ destroy Interactions     ◦ callback         ‣ reply         ‣ defer         ‣ get_original         ‣ update_original         ‣ delete_original         ‣ component_defer         ‣ component_update         ‣ autocomplete_reply         ‣ modal_reply         ‣ upgrade     ◦ followup         ‣ retrieve         ‣ create         ‣ update         ‣ destroy Invites     ◦ retrieve     ◦ revoke OAuth 2 Stage Instances     ◦ retrieve     ◦ create     ◦ update     ◦ destroy Users     ◦ retrieve     ◦ currentUser     ◦ myGuilds     ◦ currentMember     ◦ updateCurrent     ◦ connections     ◦ appRoleConnection     ◦ updateAppRoleConnection     ◦ createDM     ◦ createGroupDM     ◦ leaveGuild Webhooks     ◦ retrieve     ◦ retrieveWithToken     ◦ retrieveChannel     ◦ retrieveGuild     ◦ retrieveMessage     ◦ updateMessage     ◦ destroyMessage     ◦ create     ◦ update     ◦ updateWithToken     ◦ destroy     ◦ destroyWithToken     ◦ execute Objects/Types     ◦ Guilds     ◦ Users     ◦ Channels     ◦ Interactions     ◦ Roles     ◦ Emojis/Stickers     ◦ Message Components     ◦ Webhooks     ◦ Invites     ◦ Application     ◦ Audit Log     ◦ Auto Moderation

OpenAI Methods

Chat     ◦ create Images     ◦ create Speech     ◦ create Embeddings     ◦ create

Slack Methods

Docs coming soon

Spotify Methods

Users     ◦ me     ◦ topItems     ◦ getProfile Search     ◦ advanced     ◦ artists     ◦ songs     ◦ albums Songs     ◦ retrieve     ◦ retrieveMany     ◦ recommendations     ◦ save     ◦ unsave     ◦ saved     ◦ isSaved     ◦ analyze     ◦ audioFeatures     ◦ audioFeaturesMany Artists     ◦ retrieve     ◦ retrieveMany     ◦ recommendations     ◦ albums     ◦ related     ◦ follow     ◦ unfollow     ◦ following     ◦ isFollowing Albums     ◦ retrieve     ◦ retrieveMany     ◦ songs     ◦ new     ◦ save     ◦ unsave     ◦ saved     ◦ isSaved Playlists     ◦ featured     ◦ category     ◦ create     ◦ addSongs     ◦ update     ◦ updateSongs     ◦ removeSongs     ◦ retrieveSongs     ◦ created     ◦ following     ◦ isFollowing     ◦ follow     ◦ unfollow     ◦ user     ◦ cover     ◦ updateCover Playback     ◦ state     ◦ currentSong     ◦ devices     ◦ togglePlayback     ◦ pause     ◦ skip     ◦ previous     ◦ seek     ◦ setVolume     ◦ toggleShuffle     ◦ toggleRepeat     ◦ queue     ◦ recent     ◦ addToQueue     ◦ transfer

Utils Methods

Storage     ◦ get     ◦ getMany     ◦ set     ◦ setMany     ◦ delete     ◦ deleteMany     ◦ merge     ◦ push     ◦ export     ◦ filter     ◦ all     ◦ has     ◦ entries     ◦ keys     ◦ values     ◦ size     ◦ bytes     ◦ toJson     ◦ clear     ◦ equals     ◦ history     ◦ clearHistory


Discord

Guilds

All functions relating to Discord Guilds (servers)

MethodDescription
retrieveGet information about a guild
createCreate a new guild
updateModify a guild's settings
destroyDelete a guild
getPreviewGet the guild's preview
retrieveGet guild ban with given id
getAllGet a list of a guild's bans
createCreate a new guild ban
destroyDelete a guild ban
getInvitesGet a list of a guild's invites
updateMFAlevelModify the guild's MFA level
getPruneCountGet number of members that would be removed in a prune operation
beginPruneBegin a prune operation
getVoiceRegionsGet a list of a guild's voice regions
getAllIntegrationsGet a list of a guild's integrations
destroyIntegrationDelete a guild integration
retrieveWidgetGet the guild's widget
retrieveWidgetSettingsGet the guild's widget settings
retrieveWidgetImageGet the guild's widget image
updateWidgetModify the guild's widget
retrieveVanityURLGet the guild's vanity url
retrieveWelcomeScreenGet the guild's welcome screen
updateWelcomeScreenModify the guild's welcome screen
retrieveOnboardingGet the guild's onboarding
updateOnboardingModify the guild's onboarding
newMemberWelcome* undocumented

Get Guild

Parameters
FieldTypeDescription
guild_idsnowflakethe id of the guild
with_counts?booleanApprocimate member and presence counts
Example
await mapih.discord.guilds.retrieve({
  guild_id: '0000000000'
});

Create Guild

This endpoint can be used only by bots in less than 10 servers.

Parameters
FieldTypeDescription
namestringName of the guild (2-100 characters)
icon?string/bufferGuild icon (url to image or image buffer)
roles?array of Role objectsRoles to add to the guild
channels?array of PartialChannel objectsChannels to add to the guild
verification_level?numberThe guild's verification level
default_message_notifications?numberDefault message notification level
explicit_content_filter?numberExplicit content filter level
afk_channel_id?snowflakeID for afk channel
afk_timeout?numberafk timeout in seconds, can be set to: 60, 300, 900, 1800, 3600
system_channel_id?snowflakeThe id of the channel where guild notices such as welcome messages and boost events are posted
system_channel_flags?numberSystem channel flags
Example
await mapih.discord.guilds.create({
  name: "Eric's Server",
  icon: 'https://imgurl.png', // or buffer
  default_message_notifications: 1, // ONLY_MENTIONS
  verification_level: 0, // NONE
  explicit_content_filter: 0, // DISABLED
  roles: [{
    name: 'Administrator',
    permissions: 1 << 3,
    hoist: 'true',
    mentionable: 'false'
  }],
  channels: [
    {
      name: 'my-category',
      type: 4, // GUILD_CATEGORY
      id: 1
    },
    {
      name: 'bot-testing',
      type: 0, // GUILD_TEXT
      id: 2,
      parent_id: 1 // 'my-category'
    }
  ]
});

Modify Guild

Parameters
FieldTypeDescription
namestringName of the guild (2-100 characters)
descriptionstring
owner_idsnowflakeUser id to transfer server ownership to
iconurl/buffer
splashurl/buffer
discovery_splashurl/buffer
bannerurl/buffer
verification_levelnumberThe guild's verification level
default_message_notificationsnumberDefault message notification level
explicit_content_filternumberExplicit content filter level
afk_channel_idsnowflakeid for afk channel
afk_timeoutnumberafk timeout in seconds, can be set to: 60, 300, 900, 1800, 3600
system_channel_idsnowflakeThe id of the channel where guild notices such as welcome messages and boost events are posted
system_channel_flagsnumberSystem channel flags
rules_channel_idsnowflake
system_updates_channel_idsnowflake
premium_progress_bar_enablednumber
Example
await mapih.discord.guilds.update({
  name: "Eric's New Server",
  // ...
});

Delete Guild

Parameters
FieldTypeDescription
guild_idsnowflakethe id of the guild
Example
await mapih.discord.guilds.destroy({
  guild_id: '0000000000'
});

Get Guild Preview

• If the user is not in the guild, then the guild must be lurkable.

Parameters
FieldTypeDescription
guild_idsnowflakethe id of the guild
Example
await mapih.discord.guilds.getPreview({
  guild_id: '0000000000'
});

Get Guild Ban

• Returns a ban object for the given user or a 404 not found if the ban cannot be found. • Requires the BAN_MEMBERS permission.

Parameters
FieldTypeDescription
guild_idsnowflakethe id of the guild
user_idsnowflakeThe ID of the user the ban was created for
Example
await mapih.discord.guilds.retrieve({
  guild_id: '0000000000',
  user_id: '0000000000'
});

Get Guild Bans

Parameters
FieldTypeDescription
guild_idsnowflakethe id of the guild
limit?numberNumber of users to return (up to maximum 1000) (default 1000)
before?snowflakeConsider only users before given user ID
after?snowflakeConsider only users after given user ID
Example
await mapih.discord.guilds.getAll({
  guild_id: '0000000000',
  limit: 50,
  after: '0000000000'
});

Create Guild Ban

• Requires the BAN_MEMBERS permission.

Parameters
FieldTypeDescription
guild_idsnowflakethe id of the guild
user_idsnowflakeUser ID of the user to ban
delete_message_seconds?snowflakeNumber of seconds to delete the banned user's messages for, between 0 and 604800 (7 days).
reason?stringReason for the ban
Example
await mapih.discord.guilds.create({
  guild_id: '0000000000',
  user_id: '0000000000',
  delete_message_seconds: 604800,
  reason: 'not cool enough'
});

Remove Guild Ban

• Requires the BAN_MEMBERS permission.

Parameters
FieldTypeDescription
guild_idsnowflakethe id of the guild
user_idsnowflakeUser ID of the user to unban
reason?stringReason
Example
await mapih.discord.guilds.destroy({
  guild_id: '0000000000',
  user_id: '0000000000',
  reason: 'ok I guess you\'re alright'
});

Modify Guild MFA Level

• Requires guild ownership.

Parameters
FieldTypeDescription
guild_idsnowflakethe id of the guild
levelnumberMFA level
Example
await mapih.discord.guilds.updateMFAlevel({
  guild_id: '0000000000',
  level: 0
});

Get Guild Prune Count

• By default, prune will not remove users with roles. • You can optionally include specific roles in your prune by providing the include_roles parameter. • Any inactive user that has a subset of the provided role(s) will be counted in the prune and users with additional roles will not.

Parameters
FieldTypeDescription
guild_idsnowflakethe id of the guild
daysnumberNumber of days to count prune for (1-30) (Default 7)
include_roles?string[]An array of role IDs to include
Example
await mapih.discord.guilds.getPruneCount({
  guild_id: '0000000000',
  days: 3,
  include_roles: [
    '0000000000'
  ]
});

Begin Guild Prune

• For large guilds it's recommended to set the compute_prune_count option to false, forcing pruned to null. • By default, prune will not remove users with roles. • You can optionally include specific roles in your prune by providing the include_roles parameter. • Any inactive user that has a subset of the provided role(s) will be counted in the prune and users with additional roles will not.

Parameters
FieldTypeDescription
guild_idsnowflakethe id of the guild
daysnumberNumber of days to count prune for (1-30) (default 7)
compute_prune_countbooleanWhether pruned is returned, discouraged for large guilds (default true)
include_roles?snowflake[]An array of role IDs to include
reason?stringReason
Example
await mapih.discord.guilds.beginPrune({
  guild_id: '0000000000',
  days: 3,
  compute_prune_count: true,
  include_roles: [
    '0000000000'
  ]
});

Get Guild Voice Regions

Parameters
FieldTypeDescription
guild_idsnowflakethe id of the guild
Example
await mapih.discord.guilds.getVoiceRegions({
  guild_id: '0000000000'
});

Get Guild Integrations

This endpoint returns a maximum of 50 integrations. If a guild has more integrations, they cannot be accessed.

Parameters
FieldTypeDescription
guild_idsnowflakethe id of the guild
Example
await mapih.discord.guilds.getAllIntegrations({
  guild_id: '0000000000'
});

Delete Guild Integration

• Deletes any associated webhooks and kicks the associated bot if there is one.

Parameters
FieldTypeDescription
guild_idsnowflakethe id of the guild
integration_idsnowflakeThe ID of the integration to delete
Example
await mapih.discord.guilds.destroyIntegration({
  guild_id: '0000000000'
});

Get Guild Widget

Parameters
FieldTypeDescription
guild_idsnowflakethe id of the guild
Example
await mapih.discord.guilds.retrieveWidget({
  guild_id: '0000000000'
});

Get Guild Widget Settings

Parameters
FieldTypeDescription
guild_idsnowflakethe id of the guild
Example
await mapih.discord.guilds.retrieveWidgetSettings({
  guild_id: '0000000000'
});

Get Guild Widget Image

Widget Style Options
ValueDescriptionExample
shieldshield style widget with Discord icon and guild members online countExample
banner1large image with guild icon, name and online count. "POWERED BY DISCORD" as the footer of the widgetExample
banner2smaller widget style with guild icon, name and online count. Split on the right with Discord logoExample
banner3large image with guild icon, name and online count. In the footer, Discord logo on the left and "Chat Now" on the rightExample
banner4large Discord logo at the top of the widget. Guild icon, name and online count in the middle portion of the widget and a "JOIN MY SERVER" button at the bottomExample
Parameters
FieldTypeDescription
guild_idsnowflakethe id of the guild
stylestringWidget style (see above)
Example
await mapih.discord.guilds.retrieveWidgetImage({
  guild_id: '0000000000',
  style: 'banner3'
});

Modify Guild Widget

Parameters
FieldTypeDescription
guild_idsnowflakethe id of the guild
channel_id?snowflaketemp
enabled?booleanWhether the widget is enabled
Example
await mapih.discord.guilds.updateWidget({
  guild_id: '0000000000',
  enabled: true
});

Get Guild Vanity URL

Parameters
FieldTypeDescription
guild_idsnowflakethe id of the guild
Example
await mapih.discord.guilds.retrieveVanityURL({
  guild_id: '0000000000'
});

Get Guild Welcome Screen

Parameters
FieldTypeDescription
guild_idsnowflakethe id of the guild
Example
await mapih.discord.guilds.retrieveWelcomeScreen({
  guild_id: '0000000000'
});

Modify Guild Welcome Screen

Parameters
FieldTypeDescription
guild_idsnowflakethe id of the guild
description?stringThe server description to show in the welcome screen
enabled?booleanWhether the welcome screen is enabled.
welcome_channels?array of welcome screen channel objectsChannels shown in the welcome screen, up to 5
Example
await mapih.discord.guilds.updateWelcomeScreen({
  guild_id: '0000000000',
  enabled: true
});

Get Guild Onboarding

Parameters
FieldTypeDescription
guild_idsnowflakethe id of the guild
Example
await mapih.discord.guilds.retrieveOnboarding({
  guild_id: '0000000000',
  enabled: true
});

Modify Guild Onboarding

• Requires the MANAGE_GUILD and MANAGE_ROLES permissions. • Onboarding enforces constraints when enabled. These constraints are that there must be at least 7 Default Channels and at least 5 of them must allow sending messages to the @everyone role. The mode field modifies what is considered when enforcing these constraints.**

Parameters
FieldTypeDescription
guild_idsnowflakethe id of the guild
promptsarray of onboarding prompt objectsPrompts shown during onboarding and in customize commutity
default_channel_idsarray of snowflakesChannel IDs that members get opted into automatically
enabledbooleanWhether onboarding is enabled in the guild
modeonboarding modeCurrent mode of onboarding
Example
await mapih.discord.guilds.updateOnboarding({
  guild_id: '0000000000',
  prompts: [{
    id: '0000000000',
    type: 0,
    title: 'Prompt Title',
    single_select: true,
    required: true,
    in_onboarding: true,
    options: [{
      title: 'Option Title',
      description: 'Option description',
      id: '0000000000',
      channel_ids: [
        '0000000000'
      ],
      role_ids: [
        '0000000000'
      ],
      emoji: {
        id: '0000000000',
        name: 'emoji_name',
        animated: false
      }
    }]
  }]
});

Guild Channels

MethodDescription
getAllRetrieve all channels in a guild.
createCreate a new guild channel.
updatePositionsModify the positions of channels.

Get Guild Channels

Does not include threads
Parameters
FieldTypeDescription
guild_idsnowflakethe id of the guild
Example
await mapih.discord.guilds.channels.getAll({
  guild_id: '0000000000'
});

Create Guild Channel

All parameters to this endpoint are optional and nullable excluding name

Parameters
FieldTypeDescriptionChannel Type
namestringchannel name (1-100 characters)All
typenumberthe type of channelAll
topicstringchannel topic (0-1024 characters)Text, Announcement, Forum, Media
bitratenumberthe bitrate (in bits) of the voice or stage channel; min 8000Voice, Stage
user_limitnumberthe user limit of the voice channelVoice, Stage
rate_limit_per_usernumberamount of seconds a user has to wait before sending another message (0-21600); bots, as well as users with the permission manage_messages or manage_channel, are unaffectedText, Voice, Stage, Forum, Media
positionnumbersorting position of the channelAll
permission_overwritesarray of partial overwrite objectsthe channel's permission overwritesAll
parent_idsnowflakeid of the parent category for a channelText, Voice, Announcement, Stage, Forum, Media
nsfwbooleanwhether the channel is nsfwText, Voice, Announcement, Stage, Forum
rtc_regionstringchannel voice region id of the voice or stage channel, automatic when set to nullVoice, Stage
video_quality_modenumberthe camera video quality mode of the voice channelVoice, Stage
default_auto_archive_durationnumberthe default duration that the clients use (not the API) for newly created threads in the channel, in minutes, to automatically archive the thread after recent activityText, Announcement, Forum, Media
default_reaction_emojidefault reaction objectemoji to show in the add reaction button on a thread in a GUILD_FORUM or a GUILD_MEDIA channelForum, Media
available_tagsarray of tag objectsset of tags that can be used in a GUILD_FORUM or a GUILD_MEDIA channelForum, Media
default_sort_ordernumberthe default sort order type used to order posts in GUILD_FORUM and GUILD_MEDIA channelsForum, Media
default_forum_layoutnumberthe default forum layout view used to display posts in GUILD_FORUM channelsForum
default_thread_rate_limit_per_usernumberthe initial rate_limit_per_user to set on newly created threads in a channel. this field is copied to the thread at creation time and does not live update.Text, Announcement, Forum, Media
Example
await mapih.discord.guilds.channels.create({
  guild_id: '0000000000',
  name: 'my-new-channel',
  type: 0,
  topic: 'Cool people only',
  position: 19
});

Modify Guild Channel Positions

Only channels to be modified are required

Parameters
FieldTypeDescription
idsnowflakechannel id
position??numbersorting position of the channel
lock_permissions??booleansyncs the permission overwrites with the new parent, if moving to a new category
parent_id??snowflakethe new parent ID for the channel that is moved
Example
await mapih.discord.guilds.channels.updatePositions({
  guild_id: '0000000000',
  channels: [{
    id: '0000000000',
    position: 3,
    lock_permissions: true,
    parent_id: '0000000000'
  }]
});

Guild Members

MethodDescription
retrieveReturns information about a user
getAllList all members of a guild
searchSearch for guild members by name or nickname
removeRemove a member from a guild
updateModify attributes of a guild member
updateCurrentModify the current bot's nickname in the guild
addRoleAdd a role to a guild member
removeRoleRemove a role from a guild member
getPermissionNamesGet a user's permission's names
timeoutUpdate a member's communication timeout

Get Guild Member

Parameters
FieldTypeDescription
guild_idsnowflakethe id of the guild
user_idsnowflakeThe ID of the user
Example
await mapih.discord.guilds.members.retrieve({
  guild_id: '0000000000',
  user_id: '0000000000'
});

List Guild Members

Parameters
FieldTypeDescription
guild_idsnowflakethe id of the guild
limitnumberMax number of members to return (1-1000) (default 1)
aftersnowflakeThe highest user id in the previous page (default 0)
Example
await mapih.discord.guilds.members.getAll({
  guild_id: '0000000000',
  limit: 1000
});

Search Guild Members

Parameters
FieldTypeDescription
guild_idsnowflakethe id of the guild
querystringQuery string to match username(s) and nickname(s) against
limitnumberMax number of members to return (1-1000) (default 1)
Example
await mapih.discord.guilds.members.search({
  guild_id: '0000000000',
  query: 'lostmyinfo',
  limit: 1
});

Remove Guild Member

Parameters
FieldTypeDescription
guild_idsnowflakethe id of the guild
user_idsnowflakeThe ID of the user to remove
reason?stringReason for kick
Example
await mapih.discord.guilds.members.remove({
  guild_id: '0000000000',
  user_id: '0000000000',
  reason: 'not cool enough'
});

Modify Guild Member

• If the channel_id is set to null, this will force the target user to be disconnected from voice.

All parameters to this endpoint are optional and nullable.

Parameters
FieldTypeDescriptionPermission
guild_idsnowflakethe id of the guild
role_idsnowflakethe id of the role
nickstringvalue to set user's nickname toMANAGE_NICKNAMES
rolesarray of snowflakesarray of role ids the member is assignedMANAGE_ROLES
mutebooleanwhether the user is muted in voice channelsMUTE_MEMBERS
deafbooleanwhether the user is deafened in voice channelsDEAFEN_MEMBERS
channel_idsnowflakeid of channel to move user to (if they are connected to voice)MOVE_MEMBERS
communication_disabled_untilISO8601 timestampwhen the user's timeout will expire (up to 28 days in the future)MODERATE_MEMBERS
flagsnumberguild member flagsMODERATE_MEMBERS
Example
await mapih.discord.guilds.members.update({
  guild_id: '0000000000',
  nick: 'cool new nick'
});

Modify Current Member

Parameters
FieldTypeDescription
guild_idsnowflakethe id of the guild
nick?stringValue to set user's nickname to
Example
await mapih.discord.guilds.members.updateCurrent({
  guild_id: '0000000000',
  nick: 'cool new nick'
});

Add Guild Member Role

Parameters
FieldTypeDescription
guild_idsnowflakethe id of the guild
user_idsnowflakeThe user ID of the user to assign the role to
role_idsnowflakeThe role ID of the role to give the user
Example
await mapih.discord.guilds.members.addRole({
  guild_id: '0000000000',
  user_id: '0000000000',
  role_id: '0000000000'
});

Remove Guild Member Role

Parameters
FieldTypeDescription
guild_idsnowflakethe id of the guild
user_idsnowflakeThe user ID of the user to remove the role from
role_idsnowflakeThe role ID of the role to remove from the user
Example
await mapih.discord.guilds.members.removeRole({
  guild_id: '0000000000',
  user_id: '0000000000',
  role_id: '0000000000'
});

Get Member Permission Names

Parameters
TypeDescription
array of role IDsRoles of a member
array of role objectsRoles of a guild
Example
const x = params.member.roles;
const y = params.guild.roles;
const permNames = getPermissionNames(x, y);

Timeout Guild Member

• Sets/adjusts/clears a member's timeout

Parameters
FieldTypeDescription
guild_idsnowflakethe id of the guild
user_idsnowflakeThe user ID of the user to remove the role from
durationnumberDuration in seconds to set timeout. Set to null or omit to clear timeout.
reason?stringReason
Example
// timeout a member for 5 minutes
await mapih.discord.guilds.members.timeout({
  guild_id: '0000000000',
  user_id: '0000000000',
  duration: 300 // 5 minutes
});

// clear a member's timeout
await mapih.discord.guilds.members.timeout({
  guild_id: '0000000000',
  user_id: '0000000000'
});

Guild Roles

MethodDescription
retrieveRetrieve a role by ID
getAllList all roles in a guild
createCreate a new role in the guild
updateModify properties of a guild role
destroyModify properties of a guild role

Get Guild role

Parameters
FieldTypeDescription
guild_idsnowflakethe id of the guild
role_idsnowflakethe id of the role
Example
await mapih.discord.guilds.roles.retrieve({
  guild_id: '0000000000',
  role_id: '0000000000'
});

Get Guild Roles

Parameters
FieldTypeDescription
guild_idsnowflakethe id of the guild
Example
await mapih.discord.guilds.roles.getAll({
  guild_id: '0000000000'
});

Create Guild Role

Parameters
FieldTypeDescriptionDefault
guild_idsnowflakethe id of the guild
role_idsnowflakethe id of the role
namestringname of the role, max 100 characters"new role"
permissionsstringbitwise value of the enabled/disabled permissions@everyone
colornumberRGB color value0
hoistbooleanwhether the role should be displayed separately in the sidebarfalse
iconurl/bufferthe role's icon image (if the guild has the ROLE_ICONS feature)null
unicode_emoji?stringthe role's unicode emoji as a standard emoji (if guild has the ROLE_ICONS feature)null
mentionablebooleanwhether the role should be mentionablefalse
Example
await mapih.discord.guilds.roles.create({
  guild_id: '0000000000',
  name: 'cool kids',
  hoist: true,
  mentionable: true,
  icon: 'https://www.picofcoolkid.png'
});

Modify Guild Role

All parameters to this endpoint are optional and nullable.

Parameters
FieldTypeDescription
guild_idsnowflakethe id of the guild
role_idsnowflakethe id of the role
namestringname of the role, max 100 characters
permissionsstringbitwise value of the enabled/disabled permissions
colornumberRGB color value
hoistbooleanwhether the role should be displayed separately in the sidebar
iconurl/bufferthe role's icon image (if the guild has the ROLE_ICONS feature)
unicode_emoji?stringthe role's unicode emoji as a standard emoji (if guild has the ROLE_ICONS feature)
mentionablebooleanwhether the role should be mentionable
Example
await mapih.discord.guilds.roles.update({
  guild_id: '0000000000',
  role_id: '0000000000',
  name: 'new role name',
  hoist: false,
  mentionable: false,
  icon: 'https://www.newimage.png'
});

Delete Guild Role

Parameters
FieldTypeDescription
guild_idsnowflakethe id of the guild
role_idsnowflakethe id of the role
reason?stringreason
Example
await mapih.discord.guilds.roles.destroy({
  guild_id: '0000000000',
  role_id: '0000000000'
});

Modify Guild Role Positions

Parameters
FieldTypeDescription
guild_idsnowflakethe id of the guild
rolesarray of partial channel objectsthe ids and new positions of the channels to modify
Example
await mapih.discord.guilds.roles.retrieve({
  guild_id: '0000000000',
  roles: [
    { id: '0000000000', position: 3 },
    { id: '0000000000', position: 8 }
  ]
});

Guild Emojis

MethodDescription
retrieveGet a specific emoji from a guild
getAllList all emojis in a guild
createCreate a new emoji in the guild
updateModify a guild emoji
destroyDelete a guild emoji

Get Guild Emoji

Parameters
FieldTypeDescription
guild_idsnowflakethe id of the guild
emoji_idsnowflakeThe id of the emoji
Example
await mapih.discord.guilds.emojis.retrieve({
  guild_id: '0000000000',
  emoji_id: '0000000000'
});

List Guild Emojis

Parameters
FieldTypeDescription
guild_idsnowflakethe id of the guild
Example
await mapih.discord.guilds.emojis.getAll({
  guild_id: '0000000000'
});

Create Guild Emoji

Parameters
FieldTypeDescription
guild_idsnowflakethe id of the guild
namestringname of the emoji
imageurl/bufferthe 128x128 emoji image
rolesarray of snowflakesroles allowed to use this emoji
Example
await mapih.discord.guilds.emojis.create({
  guild_id: '0000000000',
  name: 'goodsie',
  image: 'https://picofgoodsie.png'
});

Modify Guild Emoji

Parameters
FieldTypeDescription
guild_idsnowflakethe id of the guild
emoji_idsnowflakethe id of the emoji
namestringname of the emoji
rolesarray of snowflakesroles allowed to use this emoji
Example
await mapih.discord.guilds.emojis.update({
  guild_id: '0000000000',
  emoji_id: '0000000000',
  name: 'newemojiname'
});

Destroy Guild Emoji

Parameters
FieldTypeDescription
guild_idsnowflakethe id of the guild
emoji_idsnowflakeThe id of the emoji
Example
await mapih.discord.guilds.emojis.destroy({
  guild_id: '0000000000',
  emoji_id: '0000000000'
});

Guild Stickers

MethodDescription
retrieveGet a specific sticker
retrieveGuildStickerGet a specific sticker from a guild
nitroPacksLists available sticker packs
getAllList all stickers in a guild
createCreate a guild sticker
updateUpdate a guild sticker
destroyDelete a guild sticker

Get Sticker

Parameters
FieldTypeDescription
sticker_idsnowflakeThe id of the sticker
Example
await mapih.discord.guilds.stickers.retrieve({
  sticker_id: '0000000000'
});

Get Guild Sticker

Parameters
FieldTypeDescription
guild_idsnowflakethe id of the guild
sticker_idsnowflakeThe id of the sticker
Example
await mapih.discord.guilds.stickers.retrieveGuild({
  guild_id: '0000000000',
  sticker_id: '0000000000'
});

List Sticker Packs

Example
await mapih.discord.guilds.stickers.retrieve();

List Guild Stickers

Parameters
FieldTypeDescription
guild_idsnowflakethe id of the guild
Example
await mapih.discord.guilds.stickers.getAll({
  guild_id: '0000000000'
});

Create Guild Sticker

This endpoint may take time. It goes through multiple functions before returning the sticker.

Parameters
FieldTypeDescription
guild_idsnowflakethe id of the guild
namestringname of the sticker (2-30 characters)
descriptionstringdescription of the sticker (empty or 2-100 characters)
tagsstringautocomplete/suggestion tags for the sticker (max 200 characters)
fileurl/bufferthe sticker file to upload
Example
await mapih.discord.guilds.stickers.create({
  guild_id: '0000000000',
  name: 'mynewsticker',
  description: 'cool description',
  tags: 'uhhh',
  file: 'https://uhhh.gif'
});

Modify Guild Sticker

Parameters
FieldTypeDescription
guild_idsnowflakethe id of the guild
namestringname of the sticker (2-30 characters)
descriptionstringdescription of the sticker (empty or 2-100 characters)
tagsstringautocomplete/suggestion tags for the sticker (max 200 characters)
Example
await mapih.discord.guilds.stickers.update({
  guild_id: '0000000000',
  name: 'mynewnewsticker',
  description: 'new cool description',
  tags: 'new uhhh',
});

Delete Guild Sticker

Parameters
FieldTypeDescription
guild_idsnowflakethe id of the guild
sticker_idstringthe id of the sticker
Example
await mapih.discord.guilds.stickers.destroy({
  guild_id: '0000000000',
  sticker_id: '0000000000',
});

Guild Scheduled Event

MethodDescription
retrieveGet a specific scheduled event in the guild
getAllList all scheduled events for the guild
getUsersGet users subscribed to a scheduled event
createCreate a new scheduled event in the guild
updateModify a guild scheduled event
destroyDelete a guild scheduled event

Get Guild Scheduled Event

Parameters
FieldTypeDescription
guild_idsnowflakethe id of the guild
guild_scheduled_event_idsnowflakethe id of the event
with_user_count?booleaninclude number of users subscribed to each event
Example
await mapih.discord.guilds.events.retrieve({
  guild_id: '0000000000',
  guild_scheduled_event_id: '0000000000',
  with_user_count: true
});

List Scheduled Events For Guild

Parameters
FieldTypeDescription
guild_idsnowflakethe id of the guild
with_user_count?booleaninclude number of users subscribed to each event
Example
await mapih.discord.guilds.events.getAll({
  guild_id: '0000000000',
  with_user_count: true
});

Get Guild Scheduled Event Users

Parameters
FieldTypeDescriptionDefault
guild_idsnowflakethe id of the guild
guild_scheduled_event_idsnowflakethe id of the event
limit?numbernumber of users to return (up to maximum 100)100
with_member?booleaninclude guild member data if it existsfalse
before? *snowflakeconsider only users before given user idnull
after? *snowflakeconsider only users after given user idnull

* Provide a user id to before and after for pagination. Users will always be returned in ascending order by user_id.

If both before and after are provided, only before is respected. Fetching users in-between before and after is not supported.**

Example
await mapih.discord.guilds.events.getUsers({
  guild_id: '0000000000',
  guild_scheduled_event_id: '0000000000',
  limit: 10,
  with_member: true
});

Create Guild Scheduled Event

Parameters
FieldTypeDescription
guild_idsnowflake
channel_id? *?snowflakeSet to null if changing entity type to EXTERNAL
entity_metadata? **entity metadataThe entity metadata of the scheduled event
namestringThe name of the scheduled event
privacy_levelprivacy levelThe privacy level of the scheduled event
scheduled_start_timeISO8601 timestampThe time to schedule the scheduled event
scheduled_end_time? **ISO8601 timestampThe time when the scheduled event is scheduled to end
description?stringThe description of the scheduled event
entity_typeevent entity typeThe entity type of the scheduled event
image?url/bufferThe cover image of the scheduled event

* Optional for events with 'entity_type': EXTERNAL ** Required for events with 'entity_type': EXTERNAL

Example
await mapih.discord.guilds.events.create({
  guild_id: '0000000000',
  name: 'Cool Event Name',
  privacy_level: 2,
  scheduled_start_time: '2023-04-04T11:00:00',
  entity_type: 2,
  channel_id: '0000000000'
});

Modify Guild Scheduled Event

Parameters
FieldTypeDescription
guild_idsnowflake
channel_id? *?snowflakeSet to null if changing entity type to EXTERNAL
entity_metadata??entity metadataThe entity metadata of the scheduled event
name?stringThe name of the scheduled event
privacy_level?privacy levelThe privacy level of the scheduled event
scheduled_start_time?ISO8601 timestampThe time to schedule the scheduled event
scheduled_end_time? *ISO8601 timestampThe time when the scheduled event is scheduled to end
description??stringThe description of the scheduled event
entity_type? *event entity typeThe entity type of the scheduled event
status?event statusThe status of the scheduled event
image?url/bufferThe cover image of the scheduled event

* If updating entity_type to EXTERNAL:

  • channel_id is required and must be set to null
  • entity_metadata with a location field must be provided
  • scheduled_end_time must be provided
Example
await mapih.discord.guilds.events.update({
  guild_id: '0000000000',
  guild_scheduled_event_id: '0000000000'
  name: 'Edited Event Name',
  status: 2 // ACTIVE
});

Delete Guild Scheduled Event

Parameters
FieldTypeDescription
guild_idsnowflakethe id of the guild
Example
await mapih.discord.guilds.events.destroy({
  guild_id: '0000000000'
});

Guild Templates

MethodDescription
retrieveGet a guild template by its code
getAllList all templates for a guild
createCreate a new template for the guild
createGuildCreate a new guild from a template
syncSync a guild template with the guild's current state
updateModify a guild template
destroyDelete a guild template

Get Guild Template

Parameters
FieldTypeDescription
template_codesnowflakethe template's code
Example
await mapih.discord.guilds.templates.retrieve({
  template_code: '0000000000'
});

Get Guild Templates

Parameters
FieldTypeDescription
guild_idsnowflakethe guild id
Example
await mapih.discord.guilds.templates.getAll({
  guild_id: '0000000000'
});

Create Guild Template

Parameters
FieldTypeDescription
guild_idsnowflakethe guild's id
namestringname of the template (1-100 characters)
description??stringdescription for the template (0-120 characters)
Example
await mapih.discord.guilds.templates.create({
  guild_id: '0000000000',
  name: 'fancy template'
});

Modify Guild Template

Parameters
FieldTypeDescription
guild_idsnowflakethe guild's id
template_codesnowflakethe template's code
name?stringname of the template (1-100 characters)
description??stringdescription for the template (0-120 characters)
Example
await mapih.discord.guilds.templates.update({
  guild_id: '0000000000',
  template_code: '0000000000',
  name: 'new fancy template name'
});

Delete Guild Templates

Parameters
FieldTypeDescription
guild_idsnowflakethe guild id
template_codesnowflakethe template's code
Example
await mapih.discord.guilds.templates.destroy({
  guild_id: '0000000000',
  template_code: '0000000000'
});

Create Guild Fom Guild Template

This endpoint can be used only by bots in less than 10 guilds.

Parameters
FieldTypeDescription
guild_idsnowflakethe guild's id
template_codesnowflakethe template's code
namestringname of the template (1-100 characters)
icon?url/bufferimage url or image buffer for the guild's icon
Example
await mapih.discord.guilds.templates.createGuild({
  template_code: '0000000000',
  name: 'Eric\'s cool server template',
  icon: 'https://templateGuildIcon.png'
});

Sync Guild Templates

Parameters
FieldTypeDescription
guild_idsnowflakethe guild id
template_codesnowflakethe template's code
Example
await mapih.discord.guilds.templates.sync({
  guild_id: '0000000000',
  template_code: '0000000000'
});

Channels

All functions relating to Discord Channels

MethodDescription
retrieveGet information about a channel in a guild
updateupdate a channel in a guild
destroyDelete a channel in a guild
editPermissionsUpdate the permissions of a channel in a guild
deletePermissionsDelete a channels permissions
getInvitesGet all invites for a channel
inviteCreateCreate a new channel invite
typingCreateTrigger the typing indicator in a channel
followAnnouncementChannelFollow an announcement channel
groupDMaddAdd a user to a group DM
groupDMremoveRemove a user from a group DM.

Get Channel

Parameters
FieldTypeDescription
channel_idsnowflakethe id of the channel
Example
await mapih.discord.channels.retrieve({
  channel_id: '0000000000'
});

Modify Channel

Parameters
FieldTypeDescriptionChannel Type
channel_idsnowflakethe id of the channel
namestring1-100 character channel nameAll
typenumberthe type of channel; only conversion between text and announcement is supported and only in guilds with the "NEWS" featureText, Announcement
position?numberthe position of the channel in the left-hand listingAll
topic?string0-1024 character channel topic (0-4096 characters for GUILD_FORUM and GUILD_MEDIA channels)Text, Announcement, Forum, Media
nsfw?booleanwhether the channel is nsfwText, Voice, Announcement, Stage, Forum, Media
rate_limit_per_user?numberamount of seconds a user has to wait before sending another message (0-21600); bots, as well as users with the permission manage_messages or manage_channel, are unaffectedText, Voice, Stage, Forum, Media
bitrate*?numberthe bitrate (in bits) of the voice or stage channel; min 8000Voice, Stage
user_limit?numberthe user limit of the voice or stage channel, max 99 for voice channels and 10,000 for stage channels (0 refers to no limit)Voice, Stage
permission_overwrites**?array of partial overwrite objectschannel or category-specific permissionsAll
parent_id?snowflakeid of the new parent category for a channelText, Voice, Announcement, Stage, Forum, Media
rtc_region?stringchannel voice region id, automatic when set to nullVoice, Stage
video_quality_mode?numberthe camera video quality mode of the voice channelVoice, Stage
default_auto_archive_duration?numberthe default duration that the clients use (not the API) for newly created threads in the channel, in minutes, to automatically archive the thread after recent activityText, Announcement, Forum, Media
flags?numberchannel flags combined as a bitfield. Currently only REQUIRE_TAG (1 << 4) is supported by GUILD_FORUM and GUILD_MEDIA channels. HIDE_MEDIA_DOWNLOAD_OPTIONS (1 << 15) is supported only by GUILD_MEDIA channelsForum, Media
available_tags?array of tag objectsthe set of tags that can be used in a GUILD_FORUM or a GUILD_MEDIA channel; limited to 20Forum, Media
default_reaction_emoji??default reaction objectthe emoji to show in the add reaction button on a thread in a GUILD_FORUM or a GUILD_MEDIA channelForum, Media
default_thread_rate_limit_per_user?numberthe initial rate_limit_per_user to set on newly created threads in a channel. this field is copied to the thread at creation time and does not live update.Text, Forum, Media
default_sort_order??numberthe default sort order type used to order posts in GUILD_FORUM and GUILD_MEDIA channelsForum, Media
default_forum_layout?numberthe default forum layout type used to display posts in GUILD_FORUM channelsForum

* For voice channels, normal servers can set bitrate up to 96000, servers with Boost level 1 can set up to 128000, servers with Boost level 2 can set up to 256000, and servers with Boost level 3 or the VIP_REGIONS guild feature can set up to 384000. For stage channels, bitrate can be set up to 64000. ** In each overwrite object, the allow and deny keys can be omitted or set to null, which both default to "0".

Parameters (Thread)

• When setting archived to false, when locked is also false, only the SEND_MESSAGES permission is required. • Otherwise, requires the MANAGE_THREADS permission.

FieldTypeDescription
namestring1-100 character channel name
archivedbooleanwhether the thread is archived
auto_archive_durationnumberthe thread will stop showing in the channel list after auto_archive_duration minutes of inactivity, can be set to: 60, 1440, 4320, 10080
lockedbooleanwhether the thread is locked; when a thread is locked, only users with MANAGE_THREADS can unarchive it
invitablebooleanwhether non-moderators can add other non-moderators to a thread; only available on private threads
rate_limit_per_user?numberamount of seconds a user has to wait before sending another message (0-21600); bots, as well as users with the permission manage_messages, manage_thread, or manage_channel, are unaffected
flags?numberchannel flags; PINNED can only be set for threads in forum and media channels
applied_tags?array of snowflakesthe IDs of the set of tags that have been applied to a thread in a GUILD_FORUM or a GUILD_MEDIA channel; limited to 5
Example
await mapih.discord.channels.update({
  channel_id: '0000000000',
  name: 'new-name'
});

Delete Channel

Parameters
FieldTypeDescription
channel_idsnowflakethe id of the channel
Example
await mapih.discord.channels.destroy({
  channel_id: '0000000000'
});

Edit Channel Permissions

Parameters
FieldTypeDescription
channel_idsnowflakethe id of the channel
allow?string?the bitwise value of all allowed permissions (default "0")
deny?string?the bitwise value of all disallowed permissions (default "0")
typenumber0 for a role or 1 for a member
Example
await mapih.discord.channels.editPermissions({
  channel_id: '0000000000',
  overwrite_id: '0000000000',
  type: 1, // member
  allow: '1024'
});

Delete Channel Permissions

Parameters
FieldTypeDescription
channel_idsnowflakethe id of the channel
Example
await mapih.discord.channels.deletePermissions({
  channel_id: '0000000000'
});

Get Channel Invites

Parameters
FieldTypeDescription
channel_idsnowflakethe id of the channel
Example
await mapih.discord.channels.getInvites({
  channel_id: '0000000000'
});

Create Channel Invite

Parameters
FieldTypeDescription
channel_idsnowflakethe id of the channel
usesnumbernumber of times this invite has been used
max_usesnumbermax number of times this invite can be used
max_agenumberduration (in seconds) after which the invite expires
temporarybooleanwhether this invite only grants temporary membership
created_atISO8601 timestampwhen this invite was created
Example
await mapih.discord.channels.inviteCreate({
  channel_id: '0000000000',
  max_age: 7200,
  max_uses: 1
});

Trigger Typing Indicator

Parameters
FieldTypeDescription
channel_idsnowflakethe id of the channel
Example
await mapih.discord.channels.typingCreate({
  channel_id: '0000000000'
});

Follow Announcement Channel

Parameters
FieldTypeDescription
channel_idsnowflakethe id of the channel to send announcements to
webhook_channel_idsnowflakethe id of the target channel
Example
await mapih.discord.channels.followAnnouncementChannel({
  channel_id: '0000000000',
  webhook_channel_id: '0000000000'
});

Group DM Add Recipient

Parameters
FieldTypeDescription
channel_idsnowflakethe id of the channel to send announcements to
user_idsnowflakethe id of the channel to send announcements to
access_tokenstringaccess token of a user that has granted your app the gdm.join scope
nickstringnickname of the user being added
Example
await mapih.discord.channels.groupDMadd({
  channel_id: '0000000000',
  user_id: '0000000000',
  access_token: 'abcdef123456',
  nick: 'userNickname'
});

Group DM Remove Recipient

Parameters
FieldTypeDescription
channel_idsnowflakethe id of the channel to send announcements to
user_idsnowflakethe id of the user to remove
Example
await mapih.discord.channels.groupDMremove({
  channel_id: '0000000000',
  user_id: '0000000000'
});

Channel Messages

MethodDescription
retrieveRetrieve a message with given id
getAllGet all messages in a channel
createCreate a new message
updateUpdate a message
destroyDelete a message
bulkDeleteDelete multiple messages at a time
crosspostCrosspost a message
pinPin a message
unpinUnpin a message
getPinnedGet all pinned messages in a channel

Get Channel Message

Parameters
FieldTypeDescription
channel_idsnowflakethe id of the channel
message_idsnowflakethe id of the message
Example
await mapih.discord.channels.messages.retrieve({
  channel_id: '0000000000',
  message_id: '0000000000'
});

Get Channel Messages

Parameters
FieldTypeDescription
channel_idsnowflakethe id of the channel
around?snowflakeGet messages around this message ID
before?snowflakeGet messages before this message ID
after?snowflakeGet messages after this message ID
limit?numberMax number of messages to return (1-100) (default 50)

The before, after, and around parameters are mutually exclusive, only one may be passed at a time.

Example
await mapih.discord.channels.messages.getAll({
  channel_id: '0000000000',
  limit: 50
});

Create Message

To create a message as a reply to another message, apps can include a message_reference with a message_id. • The channel_id and guild_id in the message_reference are optional, but will be validated if provided.

Parameters
FieldTypeDescription
channel_idsnowflakeChannel id of the channel to send the message to
content?*stringMessage contents (up to 2000 characters)
tts?booleantrue if this is a TTS message
embeds?*array of embed objectsUp to 10 rich embeds (up to 6000 characters)
allowed_mentions?allowed mention objectAllowed mentions for the message
message_reference?message referenceInclude to make your message a reply
components?*array of message component objectsComponents to include with the message
sticker_ids?*array of snowflakesIDs of up to 3 stickers in the server to send in the message
attachments?array of partial attachment objectsAttachment objects with filename and description.
flags?numberMessage flags (only SUPPRESS_EMBEDS and SUPPRESS_NOTIFICATIONS can be set)

* At least one of content, embeds, sticker_ids, components, or files[n] is required.

Example
await mapih.discord.channels.messages.create({
  channel_id: '0000000000',
  content: 'sup'
});
Example
await mapih.discord.channels.messages.create({
  channel_id: '0000000000',
  content: '',
  embeds: [{
    title: 'embed title',
    description: 'embed description'
  }],
  components: [{
    type: 1,
    components: [{
      type: 2, // button
      style: 1,
      label: 'buttonLabel',
      custom_id: 'asdfghjkl'
    }]
  }]
});
Example
await mapih.discord.channels.messages.create({
  channel_id: '0000000000',
  content: 'this will surprese all mentions',
  allowed_mentions: {
    parse: []
  }
});

Edit Message

Parameters
FieldTypeDescription
channel_idsnowflakethe id of the channel the message is in
message_idsnowflakethe id of the message to edit
content?stringMessage contents (up to 2000 characters)
embeds?array of embed objectsUp to 10 rich embeds (up to 6000 characters)
allowed_mentions?allowed mention objectAllowed mentions for the message
message_reference?message referenceInclude to make your message a reply
components?array of message component objectsComponents to include with the message
attachments?array of partial attachment objectsAttachment objects with filename and description.
flags?numberMessage flags (only SUPPRESS_EMBEDS and SUPPRESS_NOTIFICATIONS can be set)

• When the content field is edited, the mentions array in the message object will be reconstructed from scratch based on the new content. • The allowed_mentions field of the edit request controls how this happens. • If there is no explicit allowed_mentions in the edit request, the content will be parsed with default allowances, that is, without regard to whether or not an allowed_mentions was present in the request that originally created the message. • The attachments array must contain all attachments that should be present after edit, including retained and new attachments.

Example
await mapih.discord.channels.messages.update({
  channel_id: '0000000000',
  message_id: '0000000000',
  content: 'new message'
});

Delete Message

Parameters
FieldTypeDescription
channel_idsnowflakethe id of the channel
message_idsnowflakethe id of the message
Example
await mapih.discord.channels.messages.destroy({
  channel_id: '0000000000',
  message_id: '0000000000'
});

Bulk Delete Messages

• Any message IDs given that do not exist or are invalid will count towards the minimum and maximum message count (currently 2 and 100 respectively).

This endpoint will not delete messages older than 2 weeks.

Parameters
FieldTypeDescription
channel_idsnowflakethe id of the channel
messagesarray of snowflakesan array of message ids to delete (2-100)
Example
await mapih.discord.channels.messages.bulkDelete({
  channel_id: '0000000000',
  messages: [
    '0000000000',
    '0000000000'
  ]
});

Crosspost Message

Parameters
FieldTypeDescription
channel_idsnowflakethe id of the channel
message_idsnowflakethe message id of the message to crosspost
Example
await mapih.discord.channels.messages.crosspost({
  channel_id: '0000000000',
  message_id: '0000000000'
});

Pin Message

Parameters
FieldTypeDescription
channel_idsnowflakethe id of the channel
message_idsnowflakethe message id of the message to pin
Example
await mapih.discord.channels.messages.pin({
  channel_id: '0000000000',
  message_id: '0000000000'
});

Unpin Message

Parameters
FieldTypeDescription
channel_idsnowflakethe id of the channel
message_idsnowflakethe message id of the message to unpin
Example
await mapih.discord.channels.messages.unpin({
  channel_id: '0000000000',
  message_id: '0000000000'
});

Get Pinned Messages

Parameters
FieldTypeDescription
channel_idsnowflakethe id of the channel
Example
await mapih.discord.channels.messages.getPinned({
  channel_id: '0000000000'
});

Channel Threads

All functions relating to Discord Threads

MethodDescription
forumThreadCreateCreate a thread in a forum channel
createFromMessageCreate a thread from an existing message
createWithoutMessageCreate a thread that is not connected to an existing message
joinAdd current user to a thread
leaveRemoves current user from a thread
addMemberAdds another member to a thread
removeMemberRemoves another member from a thread
retrieveMemberRetrieve information of a thread member
getAllMembersGet all members in a thread
getAllPublicArchivedRetrieve threads in a channel that are public
getAllPrivateArchivedRetrieve private archived threads in a channel
getAllJoinedPrivateArchivedRetrieve private archived threads that the user has joined

Start Thread in Forum Channel

Parameters
FieldTypeDescription
channel_idsnowflakethe id of the channel
namestring1-100 character channel name
auto_archive_duration?*integerduration in minutes to automatically archive the thread after recent activity, can be set to: 60, 1440, 4320, 10080
rate_limit_per_user??integeramount of seconds a user has to wait before sending another message (0-21600)
messageforum thread message params objectcontents of the first message in the forum/media thread
applied_tags?array of snowflakesthe IDs of the set of tags that have been applied to a thread in a GUILD_FORUM or a GUILD_MEDIA channel
Example
await mapih.discord.channels.threads.forumThreadCreate({
  channel_id: '0000000000',
  name: 'thread name',
  message: {
    content: 'new message',
    embeds: [{
      title: 'example',
      description: 'example'
    }]
  },
  auto_archive_duration: 4320
});

Start Thread from Message

• When called on a GUILD_TEXT channel, creates a PUBLIC_THREAD. • When called on a GUILD_ANNOUNCEMENT channel, creates an ANNOUNCEMENT_THREAD. • Does not work on a GUILD_FORUM channel. • The ID of the created thread will be the same as the ID of the source message, and as such a message can only have a single thread created from it.

Parameters
FieldTypeDescription
channel_idsnowflakethe id of the channel
message_idsnowflakethe id of the message to create the thread from
namestring1-100 character channel name
auto_archive_duration?numberduration in minutes to automatically archive the thread after recent activity, can be set to: 60, 1440, 4320, 10080
rate_limit_per_user??numberamount of seconds a user has to wait before sending another message (0-21600)
Example
await mapih.discord.channels.threads.createFromMessage({
  channel_id: '0000000000',
  message_id: '0000000000',
  name: 'thread name',
  auto_archive_duration: 10080
});

Start Thread without Message

Parameters
FieldTypeDescription
channel_idsnowflakethe id of the channel
namestring1-100 character channel name
type? *numberthe type of thread to create
invitable? *booleanwhether non-moderators can add other non-moderators to a thread; only available when creating a private thread
rate_limit_per_user??numberamount of seconds a user has to wait before sending another message (0-21600)

* type currently defaults to PRIVATE_THREAD in order to match the behavior when thread documentation was first published.

Example
await mapih.discord.channels.threads.createWithoutMessage({
  channel_id: '0000000000',
  type: 11, // PUBLIC_THREAD
  name: 'thread name',
  auto_archive_duration: 10080,
  invitable: true
});

Join Thread

Parameters
FieldTypeDescription
channel_idsnowflakethe id of the channel
Example
await mapih.discord.channels.threads.join({
  channel_id: '0000000000'
});

Leave Thread

Parameters
FieldTypeDescription
channel_idsnowflakethe id of the channel
Example
await mapih.discord.channels.threads.leave({
  channel_id: '0000000000'
});

Add Thread Member

Parameters
FieldTypeDescription
channel_idsnowflakethe id of the channel
user_idsnowflakethe id of the user to add
Example
await mapih.discord.channels.threads.addMember({
  channel_id: '0000000000',
  user_id: '0000000000'
});

Remove Thread Member

Parameters
FieldTypeDescription
channel_idsnowflakethe id of the channel
user_idsnowflakethe id of the user to add
Example
await mapih.discord.channels.threads.removeMember({
  channel_id: '0000000000',
  user_id: '0000000000'
});

Get Thread Member

Parameters
FieldTypeDescription
channel_idsnowflakethe id of the channel
user_idsnowflakethe id of the user to add
with_member?booleanwhether to include a guild member object
Example
await mapih.discord.channels.threads.retrieveMember({
  channel_id: '0000000000',
  user_id: '0000000000',
  with_member: true
});

List Thread Members

Parameters
FieldTypeDescription
channel_idsnowflakethe id of the channel
user_idsnowflakethe id of the user to add
with_member?booleanwhether to include a guild member object
after?snowflakeGet thread members after this user ID
limit?integerMax number of thread members to return (1-100). Defaults to 100.
Example
await mapih.discord.channels.threads.getAllMembers({
  channel_id: '0000000000',
  with_member: true
});

List Public Archived Threads

• When called on a GUILD_TEXT channel, returns threads of type PUBLIC_THREAD. • When called on a GUILD_ANNOUNCEMENT channel, returns threads of type ANNOUNCEMENT_THREAD. • Threads are ordered by archive_timestamp, in descending order.

Parameters
FieldTypeDescription
channel_idsnowflakethe id of the channel
before?ISO8601 timestampreturns threads archived before this timestamp
limit?integeroptional maximum number of threads to return
Example
await mapih.discord.channels.threads.getAllPublicArchived({
  channel_id: '0000000000',
  limit: 10
});

List Private Archived Threads

Parameters
FieldTypeDescription
channel_idsnowflakethe id of the channel
before?ISO8601 timestampreturns threads archived before this timestamp
limit?integeroptional maximum number of threads to return
Example
await mapih.discord.channels.threads.getAllPrivateArchived({
  channel_id: '0000000000'
});

List Joined Private Archived Threads

Parameters
FieldTypeDescription
channel_idsnowflakethe id of the channel
before?ISO8601 timestampreturns threads archived before this timestamp
limit?integeroptional maximum number of threads to return
Example
await mapih.discord.channels.threads.getAllJoinedPrivateArchived({
  channel_id: '0000000000'
});

Channel Reactions

MethodDescription
createCreate a reaction for the message
createManyCreate multiple reactions to a message at once
deleteOwnDelete a reaction the current user has made for the message
deleteUserDeletes another user's reaction
deleteAllDeletes all reactions on a message
deleteAllEmojiDeletes all the reactions for a given emoji on a message
getUsersGet a list of users that reacted with this emoji

Create Reaction

Parameters

| Field | Type | Description | |------------------------|-------------------------| | channel_id | snowflake | the id of the channel | | message_id | snowflake | the id of the message | | emoji | string | the emoji to react with |

Example
await mapih.discord.channels.reactions.create({
  channel_id: '0000000000',
  message_id: '0000000000',
  emoji: 'name:id'
});

Create Multiple Reactions

Parameters

| Field | Type | Description | |------------------------|--------------------------------------------------------------------------------------------------| | channel_id | snowflake | The id of the channel | | message_id | snowflake | The id of the message | | emojis | string[] | An array of emoji parameters | | delay? | number | Amount of millseconds to wait between reactions. For use when getting rate-limited. Default 300. |

Example
await mapih.discord.channels.reactions.createMany({
  channel_id: '0000000000',
  message_id: '0000000000',
  emojis: [
    'name:id:',
    'name:id:',
    'name:id:'
  ],
  delay: 200
});

Delete Own Reaction

Parameters

| Field | Type | Description | |------------------------|-------------------------| | channel_id | snowflake | the id of the channel | | message_id | snowflake | the id of the message | | emoji | string | the emoji to react with |

Example
await mapih.discord.channels.reactions.deleteOwn({
  channel_id: '0000000000',
  message_id: '0000000000',
  emoji: 'name:id'
});

Delete User Reaction

Parameters

| Field | Type | Description | |------------------------|-----------------------------------------| | channel_id | snowflake | the id of the channel | | message_id | snowflake | the id of the message | | user_id | snowflake | the id the user the reaction belongs to | | emoji | string | the emoji to react with |

Example
await mapih.discord.channels.reactions.deleteUser({
  channel_id: '0000000000',
  message_id: '0000000000',
  user_id: '0000000000',
  emoji: 'name:id'
});

Delete All Reactions

Parameters

| Field | Type | Description | |------------------------|-------------------------| | channel_id | snowflake | the id of the channel | | message_id | snowflake | the id of the message |

Example
await mapih.discord.channels.reactions.deleteAll({
  channel_id: '0000000000',
  message_id: '0000000000'
});

Delete All Reactions for Emoji

Parameters

| Field | Type | Description | |------------------------|-------------------------| | channel_id | snowflake | the id of the channel | | message_id | snowflake | the id of the message | | emoji | string | the emoji to delete |

Example
await mapih.discord.channels.reactions.deleteAllEmoji({
  channel_id: '0000000000',
  message_id: '0000000000',
  emoji: ':name:id'
});

Get Reactions

Parameters

| Field | Type | Description | |------------------------|----------------------------------------------------| | channel_id | snowflake | the id of the channel | | message_id | snowflake | the id of the message | | emoji | string | the emoji to get users for | | after? | snowflake | Get users after this user ID | | limit? | integer | Max number of users to return (1-100) (default 25) |

Example
await mapih.discord.channels.reactions.getUsers({
  channel_id: '0000000000',
  message_id: '0000000000',
  emoji: ':name:id',
  limit: 50
});

Users

All functions relating to Discord Users

Endpoints

MethodDescription
retrieveGet user object for given user id
currentUserGet user object of requester's account
myGuildsGet a list of partial guild objects the current user is a member of
currentMemberGet guild member object for the current user
updateCurrentModify the requester's user account settings
connectionsGet a list of the user's connections
appRoleConnectionGet user's application role connection object
updateAppRoleConnectionUpdates the user's application role connection
createDMCreate a new DM channel with a user
createGroupDMCreate a new group DM channel with multiple users
leaveGuildLeave a guild

Get User

Parameters
FieldTypeDescription
user_idsnowflakethe id of the user
Example
await mapih.discord.users.retrieve({
  user_id: '0000000000'
});

Get Current User

Example
await mapih.discord.users.currentUser();

Get Current User Guilds

Parameters
FieldTypeDescription
beforesnowflakeget guilds before this guild ID
aftersnowflakeget guilds after this guild ID
limitintegermax number of guilds to return (1-200) (default 200)
with_countsbooleaninclude approximate member and presence counts in response
Example
await mapih.discord.users.myGuilds();

Get Current User Guild Member

Parameters
FieldTypeDescription
guild_idsnowflakeid of the guild to get member object from
Example
await mapih.discord.users.currentMember({
  guild_id: '0000000000',
});

Modify Current User

All parameters to this endpoint are optional.

FieldTypeDescription
usernamestringuser's username
avatarurl/bufferif passed, modifies the user's avatar
Example
await mapih.discord.users.updateCurrent({
  username: 'new username',
  avatar: 'https://imageURL.png'
});

Get User Connections

Example
await mapih.discord.users.connections();

Get User Application Role Connection

Parameters
FieldTypeDescription
application_id?snowflakebot's application id
Example
await mapih.discord.users.appRoleConnection();

Update User Application Role Connection

Requires an OAuth2 access token with role_connections.write scope for the application specified in the path.

Parameters
FieldTypeDescription
platform_name?stringthe vanity name of the platform a bot has connected (max 50 characters)
platform_username?stringthe username on the platform a bot has connected (max 100 characters)
metadata?objectobject mapping application role connection metadata keys to their string-ified value (max 100 characters) for the user on the platform a bot has connected
Example
await mapih.discord.users.updateAppRoleConnection({
  platform_name: 'OnSocket',
  platform_username: 'goodsie'
});

Create DM

Parameters
FieldTypeDescription
recipient_idsnowflakethe recipient to open a DM channel with
content?*stringMessage contents (up to 2000 characters)
tts?booleantrue if this is a TTS message
embeds?*array of embed objectsUp to 10 rich embeds (up to 6000 characters)
allowed_mentions?allowed mention objectAllowed mentions for the message
message_reference?message referenceInclude to make your message a reply
components?*array of message component objectsComponents to include with the message
sticker_ids?*array of snowflakesIDs of up to 3 stickers in the server to send in the message
attachments?array of partial attachment objectsAttachment objects with filename and description.
flags?integerMessage flags (only SUPPRESS_EMBEDS and SUPPRESS_NOTIFICATIONS can be set)

* At least one of content, embeds, sticker_ids, components, or files[n] is required.

Example
await mapih.discord.users.createDM({
  recipient_id: '0000000000',
  content: '<super cool message here>'
});

Create Group DM

Parameters
FieldTypeDescription
access_tokensarray of stringsaccess tokens of users that have granted your app the gdm.join scope
nicksdicta dictionary of user ids to their respective nicknames
content?*stringMessage contents (up to 2000 characters)
tts?booleantrue if this is a TTS message
embeds?*array of embed objectsUp to 10 rich embeds (up to 6000 characters)
allowed_mentions?allowed mention objectAllowed mentions for the message
message_reference?message referenceInclude to make your message a reply
components?*array of message component objectsComponents to include with the message
sticker_ids?*array of snowflakesIDs of up to 3 stickers in the server to send in the message
attachments?array of partial attachment objectsAttachment objects with filename and description.
flags?integerMessage flags (only SUPPRESS_EMBEDS and SUPPRESS_NOTIFICATIONS can be set)

* At least one of content, embeds, sticker_ids, components, or files[n] is required.

Example
await mapih.discord.users.createGroupDM({
  access_tokens: [
    '0000000000',
    '0000000000'
  ],
  nicks: {
    'user_id': 'nickname'
  },
  content: 'boo',
});

Leave Guild

Parameters
FieldTypeDescription
guild_idsnowflakethe id of the guild to leave
Example
await mapih.discord.users.leaveGuild({
  guild_id: '0000000000'
});

Interactions

Namespaces

| Namespace | | Callback | | Followup |

Interactions Callback

Endpoints
MethodDescription
replyCreate a response to an Interaction
deferSend "thinking" state and edit response later
get_originalGet the initial Interaction response
update_originalEdit the initial Interaction response
delete_originalDelete the initial Interaction response
component_defer*Acknowledge an interaction and edit response later
component_update*Edit the message the component was attached to
autocomplete_replyRespond to an autocomplete interaction with suggested choices
modal_reply**Respond to an interaction with a popup modal
upgrade***Respond to an interaction with an upgrade button

* Only valid for component-based interactions. ** Not available for MODAL_SUBMIT and PING interactions. *** Only available for apps with monetization enabled.

Create Interaction Response

Parameters
FieldTypeDescription
paramsobjectThe interaction payload
ephemeral?booleanWhether the message should be visible to only the user
content?*stringMessage contents (up to 2000 characters)
tts?booleantrue if this is a TTS message
embeds?*array of embed objectsUp to 10 rich embeds (up to 6000 characters)
allowed_mentions?allowed mention objectAllowed mentions for the message
components?*array of message component objectsComponents to include with the message
attachments?array of partial attachment objectsAttachment objects with filename and description

* At least one of content, embeds, sticker_ids, components, or files[n] is required.

Example
await mapih.discord.interactions.callback.reply(params, {
  ephemeral: true,
  content: 'This will respond to an interaction immediately'
});

Defer Interaction Response

Parameters
FieldTypeDescription
paramsobjectThe interaction payload
ephemeral?booleanWhether the message should be visible to only the user
Example
await mapih.discord.interactions.callback.defer(params, {
  ephemeral: true
});
Example
await mapih.discord.interactions.callback.defer(params)

Get Original Interaction Response

Parameters
FieldTypeDescription
paramsobjectThe interaction payload
Example
await mapih.discord.interactions.callback.get_original(params);

Edit Original Interaction Response

Parameters
FieldTypeDescription
paramsobjectThe interaction payload
content?*stringMessage contents (up to 2000 characters)
embeds?*array of embed objectsUp to 10 rich embeds (up to 6000 characters)
allowed_mentions?allowed mention objectAllowed mentions for the message
components?*array of message component objectsComponents to include with the message
attachments?array of partial attachment objectsAttachment objects with filename and description
Example
await mapih.discord.interactions.callback.update_original(params, {
  content: 'This will update the original interaction response'
});

Delete Original Interaction Response

Parameters
FieldTypeDescription
paramsobjectThe interaction payload
Example
await mapih.discord.interactions.callback.delete_original(params);

Component Defer

Parameters
FieldTypeDescription
paramsobjectThe interaction payload
Example
await mapih.discord.interactions.callback.component_defer(params);

Component Update

Parameters
FieldTypeDescription
paramsobjectThe interaction payload
content?*stringMessage contents (up to 2000 characters)
embeds?*array of embed objectsUp to 10 rich embeds (up to 6000 characters)
allowed_mentions?allowed mention objectAllowed mentions for the message
components?*array of message component objectsComponents to include with the message
attachments?array of partial attachment objectsAttachment objects with filename and description
Example
await mapih.discord.interactions.callback.component_update(params, {
  content: 'new stuff!'
});

Autocomplete Reply

Parameters
FieldTypeDescription
paramsobjectThe interaction payload
choicesarray of choicesAutocomplete Choices (max of 25 choices)
Example
await mapih.discord.interactions.callback.autocomplete_reply(params, {
  choices: [
    {
      name: 'this might be wrong',
      value: 'let me know'
    }
  ]
});

Modal Reply

Parameters
FieldTypeDescription
custom_idstringa developer-defined identifier for the modal, max 100 characters
titlestringthe title of the popup modal, max 45 characters
componentsarray of componentsbetween 1 and 5 (inclusive) components that make up the modal
Example
await callback.modal_reply(params, {
  custom_id: 'modal_id',
  title: 'Title goes here',
  components: [
    {
      type: 4,
      custom_id: 'id_1',
      label: 'this is a label',
      style: 1, // short
      placeholder: 'this is a placeholder',
      required: true
    },
    {
      type: 4,
      custom_id: 'id_2',
      label: 'This is another label',
      style: 1, // paragraph
      value: 'this is a pre-filled value',
      required: false
    }
  ]
});

Interactions Followup

Endpoints
MethodDescription
retrieveGet a followupmessage for an interaction
createCreate a followup message for an interaction
updateEdit a followup message for an interaction
destroyDelete a followup message for an interaction

Get Followup Message

Parameters
FieldTypeDescription
paramsobjectThe interaction payload
message_idsnowflakeThe message id of the message to retrieve
Example
await mapih.discord.interactions.followup.retrieve(params, {
  message_id: '0000000000'
});

Create Followup Message

Parameters
FieldTypeDescription
paramsobjectThe interaction payload
ephemeral?booleanWhether the message should be visible to only the user
content?*stringMessage contents (up to 2000 characters)
embeds?*array of embed objectsUp to 10 rich embeds (up to 6000 characters)
allowed_mentions?allowed mention objectAllowed mentions for the message
components?*array of message component objectsComponents to include with the message
attachments?array of partial attachment objectsAttachment objects with filename and description

* At least one of content, embeds, sticker_ids, components, or files[n] is required.

Example
await mapih.discord.interactions.followup.create(params, {
  ephemeral: true,
  content: 'followup message',
  embeds: [{
     title: 'hello',
     description: 'this is a description'
  }]
});

Edit Followup Message

Parameters
FieldTypeDescription
paramsobjectThe interaction payload
message_idsnowflakeThe id of the message to update
content?*stringMessage contents (up to 2000 characters)
embeds?*array of embed objectsUp to 10 rich embeds (up to 6000 characters)
allowed_mentions?allowed mention objectAllowed mentions for the message
components?*array of message component objectsComponents to include with the message
attachments?array of partial attachment objectsAttachment objects with filename and description

* At least one of content, embeds, sticker_ids, components, or files[n] is required.

Example
await mapih.discord.interactions.followup.update(params, {
  message_id: '0000000000',
  content: 'followup message',
  embeds: [{
     title: 'hello',
     description: 'this is a description'
  }]
});

Delete Followup Message

Parameters
FieldTypeDescription
paramsobjectThe interaction payload
message_idsnowflakeThe message id of the message to retrieve
Example
await mapih.discord.interactions.followup.destroy(params, {
  message_id: '0000000000'
});

Webhooks

All functions relating to Discord Webhooks

Methods

MethodDescription
retrieveGet information about a webhook
retrieveWithTokenGet information about a webhook using its token
retrieveChannelGet all channel webhooks
retrieveGuildGet all guild webhooks
retrieveMessageGet a previously-sent webhook message from the same token
destroyMessageDeletes a message that was created by the webhook
createCreates a new webhook
updateUpdates an existing webhook
updateWithTokenFollow an announcement channel
destroyDelete a webhook permanently
destroyWithTokenDelete a webhook permanently using its token
executeExecutes a webhook
updateMessageEdits a previously-sent webhook message from the same token

Get Webhook

Parameters
FieldTypeDescription
webhook_idsnowflakethe id of the webhook
Example
await mapih.discord.webhooks.retrieve({
  webhook_id: '0000000000'
});

Get Webhook With Token

This call does not require authentication and returns no user in the webhook object.

Parameters
FieldTypeDescription
webhook_idsnowflakethe id of the webhook
webhook_tokenstringthe webhook's token
Example
await mapih.discord.webhooks.retrieveWithToken({
  webhook_id: '0000000000',
  webhook_token: 'abcdef123456'
});

Get Channel Webhooks

Parameters
FieldTypeDescription
channel_idsnowflakethe id of the channel
Example
await mapih.discord.webhooks.retrieveChannel({
  webhook_id: '0000000000'
});

Get Guild Webhooks

Parameters
FieldTypeDescription
guild_idsnowflakethe id of the guild
Example
await mapih.discord.webhooks.retrieveGuild({
  guild_id: '0000000000'
});

Get Webhook Message

Parameters
FieldTypeDescription
webhook_idsnowflakethe id of the webhook
webhook_tokensnowflakethe webhook's token
message_idsnowflakethe id of the message
thread_idsnowflakeid of the thread the message is in
Example
await mapih.discord.webhooks.retrieveMessage({
  webhook_id: '0000000000',
  webhook_token: 'abcdef123456',
  message_id: '0000000000'
});

Edit Webhook Message

Parameters
FieldTypeDescription
webhook_idsnowflakethe id of the webhook
webhook_tokensnowflakethe webhook's token
message_idsnowflakethe id of the message
thread_idsnowflakeid of the thread the message is in
content?stringMessage contents (up to 2000 characters)
embeds?array of embed objectsUp to 10 rich embeds (up to 6000 characters)
allowed_mentions?allowed mention objectAllowed mentions for the message
components?array of message component objectsComponents to include with the message
attachments?array of partial attachment objectsAttachment objects with filename and description
Example
await mapih.discord.webhooks.updateMessage({
  webhook_id: '0000000000',
  webhook_token: 'abcdef123456',
  message_id: '0000000000',
  content: 'hello'
});

Delete Webhook Message

Parameters
FieldTypeDescription
webhook_idsnowflakethe id of the webhook
webhook_tokensnowflakethe webhook's token
message_idsnowflakethe id of the message
thread_idsnowflakeid of the thread the message is in
Example
await mapih.discord.webhooks.destroyMessage({
  webhook_id: '0000000000',
  webhook_token: 'abcdef123456',
  message_id: '0000000000'
});

Create Webhook

Parameters
FieldTypeDescription
channel_id?snowflakethe channel id of the channel to create webhook for
name?stringname of the webhook (1-80 characters)
avatar??url/bufferimage for the default webhook avatar
Example
await mapih.discord.webhooks.create({
  channel_id: '0000000000',
  name: 'myNewWebhook'
});

Modify Webhook

Parameters
FieldTypeDescription
webhook_idsnowflakethe webhook id of the webhook to edit
channel_idsnowflakethe channel id of the channel to create webhook for
namestringname of the webhook (1-80 characters)
avatar??url/bufferimage for the default webhook avatar
Example
await mapih.discord.webhooks.update({
  webhook_id: '0000000000',
  channel_id: '0000000000',
  name: 'myNewNewWebhook'
});

Modify Webhook With Token

Parameters
FieldTypeDescription
webhook_idsnowflakethe webhook id of the webhook to edit
webhook_tokenstringthe token of the webhook to edit
name?stringname of the webhook (1-80 characters)
avatar??url/bufferimage for the default webhook avatar
Example
await mapih.discord.webhooks.updateWithToken({
  webhook_id: '0000000000',
  webhook_token: 'abcd1234',
  name: 'myNewNewWebhook'
});

Delete Webhook

Parameters
FieldTypeDescription
webhook_idsnowflakethe id of the webhook
Example
await mapih.discord.webhooks.destroy({
  webhook_id: '0000000000'
});

Delete Webhook With Token

Parameters
FieldTypeDescription
webhook_idsnowflakethe id of the webhook
webhook_tokenstringthe webhook's token
Example
await mapih.discord.webhooks.destroyWithToken({
  webhook_id: '0000000000',
  webhook_token: 'abcdef123456'
});

Execute Webhook

Parameters
FieldTypeDescription
webhook_idsnowflakethe id of the webhook
webhook_tokensnowflakethe webhook's token
usernamestringoverride the default username of the webhook
avatar_urlstringoverride the default avatar of the webhook
thread_idsnowflakeid of the thread the message is in
contentstringMessage contents (up to 2000 characters)
embedsarray of embed objectsUp to 10 rich embeds (up to 6000 characters)
allowed_mentionsallowed mention objectAllowed mentions for the message
componentsarray of message component objectsComponents to include with the message
attachmentsarray of partial attachment objectsAttachment objects with filename and description
thread_namestringname of thread to create (requires the webhook channel to be a forum or media channel)
applied_tagsarray of snowflakesarray of tag ids to apply to the thread (requires the webhook channel to be a forum or media channel)
waitbooleanWaits for server confirmation of message send before response, and returns the created message body
Example
await mapih.discord.webhooks.execute({
  webhook_id: '0000000000',
  webhook_token: 'abcdef123456',
  content: 'message contents here',
  username: 'webhook usernrame',
  avatar_url: 'https://imgurl.png',
  embeds: [{
    title: 'example',
    description: 'example'
  }]
});

Invites

All functions relating to Discord Invites

MethodDescription
retrieveGet information about a specific invite
revokeRevoke an invite

Get Invite

Parameters
FieldTypeDescription
invite_codestringthe invite's code
with_counts?booleanwhether the invite should contain approximate member counts
with_expiration?booleanwhether the invite should contain the expiration date
guild_scheduled_event_id?snowflakethe guild scheduled event to include with the invite
Example
await mapih.discord.invites.retrieve({
  invite_code: '0vCdhLbwjZZTWZLD',
  with_counts: true,
  with_expiration: true
});

Delete Invite

Parameters

| Field | Type | Description | | invite_code | string | the invite's code |

Example
await mapih.discord.invites.revoke({
  invite_code: '0vCdhLbwjZZTWZLD'
});

Applications

All Discord API endpoints relating to applications, commands, entitlements and SKUs

MethodDescription
getMeGet inforation on the current application
updateMeEdit properties of the app associated with the requesting bot user
appRoleConnectionMetaGet the applications role connection metadata information
updateAppRoleConnectionMetaUpdates the application role connection metadata for the given application

Get Current Application

Parameters
FieldTypeDescription
application_id?snowflakethe id of the application
Example
await mapih.discord.applications.getMe();

Edit Current Application

Parameters
FieldTypeDescription
application_id?snowflakethe id of the application
custom_install_urlstringDefault custom authorization URL for the app, if enabled
descriptionstringDescription of the app
role_connections_verification_urlstringRole connection verification URL for the app
install_paramsinstall params objectSettings for the app's default in-app authorization link, if enabled
flags *numberApp's public flags
iconurl/bufferIcon for the app
cover_imageurl/bufferDefault rich presence invite cover image for the app
interactions_endpoint_url **stringInteractions endpoint URL for the app
tagsarray of stringsList of tags describing the content and functionality of the app (max of 20 characters per tag). Max of 5 tags.

* Only limited intent flags (GATEWAY_PRESENCE_LIMITED, GATEWAY_GUILD_MEMBERS_LIMITED, and GATEWAY_MESSAGE_CONTENT_LIMITED) can be updated via the mapih.

Example
await mapih.discord.applications.updateMe({
  description: 'new description',
  icon: 'https://url_to_image.png' // or buffer,
  install_params: {
    scopes: [
      'identify',
      'bot',
      'applications.commands'
    ],
    permissions: '8'
  }
});

Get Application Role Connection Metadata Records

Parameters
FieldTypeDescription
application_id?snowflakethe id of the application
Example
await mapih.discord.applications.appRoleConnectionMeta();

Update Application Role Connection Metadata Records

Parameters
FieldTypeDescription
application_id?snowflakethe id of the application
Example
await mapih.discord.applications.updateAppRoleConnectionMeta();

Application Commands

MethodDescription
retrieveGet an application command
getAllGet all application commands
createCreate a new application command
updateUpdate an application command
destroyDelete an application command
bulkOverwriteBulk overwrite application commands
retrievePermissionsGet a guild commands permissions
getAllPermissionsGet permissions for all commands in a guild
updatePermissionsUpdate a guild's application command

Get Application Command

This is to be used for both global and guild commands. Provide a guild_id field if using for a guild command.

Parameters
FieldTypeDescription
command_idsnowflakethe id of the command
application_id?snowflakethe id of the application
guild_id?snowflakethe id of the guild
Example
await mapih.discord.applications.commands.retrieve({
  command_id: '0000000000',
  guild_id: '0000000000'
})

Get Application Commands

This is to be used for both global and guild commands. Provide a guild_id field if using for a guild command.

Parameters
FieldTypeDescription
application_id?snowflakethe id of the application
guild_id?snowflakethe id of the guild
with_localizations?booleanWhether to include full localization dictionaries (name_localizations and description_localizations) in the returned objects, instead of the name_localized and description_localized fields.
Example
await mapih.discord.applications.commands.getAll();
Example
await mapih.discord.applications.commands.getAll({
  guild_id: '0000000000'
})

Create Application Command

This is to be used for both global and guild commands. Provide a guild_id field if using for a guild command.

Parameters
FieldTypeDescription
application_id?snowflakethe id of the application
guild_id?snowflakethe id of the guild
namestringName of command, 1-32 characters
name_localizations??dictionary with keys in available localesLocalization dictionary for the name field. Values follow the same restrictions as name
description?string1-100 character description for CHAT_INPUT commands
description_localizations??dictionary with keys in available localesLocalization dictionary for the description field. Values follow the same restrictions as description
options?array of application command optionthe parameters for the command
default_member_permissions??stringSet of permissions represented as a bit set
dm_permission??booleanIndicates whether the command is available in DMs with the app, only for globally-scoped commands. By default, commands are visible.
type?one of application command typeType of command, defaults 1 if not set
nsfw?booleanIndicates whether the command is age-restricted
Example
await mapih.discord.applications.commands.create({
  name: 'slashcommand',
  description: 'Command description',
  guild_id: '0000000000', // optional
  options: [{
    type: 1, // SUB_COMMAND
    name: 'subCommand',
    options: [
      {
        type: 3, // STRING
        name: 'content',
        description: 'Enter content here',
        required: true
      },
      {
        type: 6, // USER
        name: 'user',
        description: 'Select a user'
      }
    ]
  }]
})

Edit Application Command

This is to be used for both global and guild commands. Provide a guild_id field if using for a guild command.

Parameters
FieldTypeDescription
application_id?snowflakethe id of the application
guild_id?snowflakethe id of the guild
namestringName of command, 1-32 characters
name_localizations??dictionary with keys in available localesLocalization dictionary for the name field. Values follow the same restrictions as name
description?string1-100 character description for CHAT_INPUT commands
description_localizations??dictionary with keys in available localesLocalization dictionary for the description field. Values follow the same restrictions as description
options?array of application command optionthe parameters for the command
default_member_permissions??stringSet of permissions represented as a bit set
dm_permission??booleanIndicates whether the command is available in DMs with the app, only for globally-scoped commands. By default, commands are visible.
nsfw?booleanIndicates whether the command is age-restricted
Example
await mapih.discord.applications.commands.update({
  name: 'slashcommand',
  description: 'Command description',
  guild_id: '0000000000', // optional
  options: [{
    type: 1, // SUB_COMMAND
    name: 'subCommand',
    options: [
      {
        type: 3, // STRING
        name: 'content',
        description: 'Enter content here',
        required: true
      },
      {
        type: 6, // USER
        name: 'user',
        description: 'Select a user'
      }
    ]
  }]
})

Delete Application Command

This is to be used for both global and guild commands. Provide a guild_id field if using for a guild command.

Parameters
FieldTypeDescription
command_idsnowflakethe id of the command
application_id?snowflakethe id of the application
guild_id?snowflakethe id of the guild
Example
await mapih.discord.applications.commands.destroy({
  command_id: '0000000000',
  guild_id: '0000000000'
})

Bulk Overwrite Application Commands

This is to be used for both global and guild commands. Provide a guild_id field if using for a guild command. • Takes a list of application commands, overwriting the existing global command list for this application.

Parameters
FieldTypeDescription
application_id?snowflakethe id of the application
guild_id?snowflakethe id of the guild
commandsarray of application commandsCommands to overwrite the existing commands with
Example
await mapih.discord.applications.commands.bulkOverwrite({
  command_id: '0000000000',
  guild_id: '0000000000',
  commands: [commands]
})

Get Application Command Permissions

• Fetches permissions for a specific command for your application in a guild.

Parameters
FieldTypeDescription
command_idsnowflakethe id of the command
application_id?snowflakethe id of the application
guild_idsnowflakethe id of the guild
Example
await mapih.discord.applications.commands.retrievePermissions({
  command_id: '0000000000',
  guild_id: '0000000000'
})

Get Guild Application Command Permissions

• Fetches permissions for all commands for your application in a guild.

Parameters
FieldTypeDescription
application_id?snowflakethe id of the application
guild_idsnowflakethe id of the guild
Example
await mapih.discord.applications.commands.getAllPermissions({
  guild_id: '0000000000'
})

Edit Application Command Permissions

• Edits command permissions for a specific command for your application in a guild.

Parameters
FieldTypeDescription
application_id?snowflakethe id of the application
guild_idsnowflakethe id of the guild
permissionsarray of application command permissionsPermissions for the command in the guild
Example
await mapih.discord.applications.commands.updatePermissions({
  guild_id: '0000000000',
  permissions: [{
    id: '0000000000',
    type: 2,
    'true'
  }]
})

Application Entitlements

MethodDescription
getAllGet all entitlements for a given app
createCreates a test entitlement to a given SKU for a given guild or user
destroyDeletes a currently-active test entitlement

List Entitlements

• Returns all entitlements for a given app, active and expired.

Parameters
FieldTypeDescription
application_id?snowflakethe id of the application
user_id?snowflakeUser ID to look up entitlements for
sku_ids?comma-delimited set of snowflakesOptional list of SKU IDs to check entitlements for
before?snowflakeRetrieve entitlements before this entitlement ID
after?snowflakeRetrieve entitlements after this entitlement ID
limit?numberNumber of entitlements to return, 1-100, default 100
guild_id?snowflakeGuild ID to look up entitlements for
exclude_ended?booleanWhether or not ended entitlements should be omitted
Example
await mapih.discord.applications.entitlements.retrieve({
  user_id: '0000000000',
  before: '0000000000',
  after: '0000000000',
  limit: 2
})

Create Test Entitlement

• Creates a test entitlement to a given SKU for a given guild or user. Discord will act as though that user or guild has entitlement to your premium offering. • This endpoint returns a partial entitlement object. It will not contain subscription_id, starts_at, or ends_at, as it's valid in perpetuity. • After creating a test entitlement, you'll need to reload your Discord client. After doing so, you'll see that your server or user now has premium access.

Parameters
FieldTypeDescription
application_id?snowflakethe id of the application
sku_idstringID of the SKU to grant the entitlement to
owner_idstringID of the guild or user to grant the entitlement to
owner_typenumber1 for a guild subscription, 2 for a user subscription
Example
await mapih.discord.applications.entitlements.create({
  sku_id: '0000000000',
  owner_id: '0000000000',
  owner_type: 1
})

Delete Test Entitlement

• Deletes a currently-active test entitlement. Discord will act as though that user or guild no longer has entitlement to your premium offering.

Parameters
FieldTypeDescription
application_id?snowflakethe id of the application
Example
await mapih.discord.applications.entitlements.delete()

Application SKUs

MethodDescription
getAllGet all SKUs for a given application

List SKUs

• Because of how our SKU and subscription systems work, you will see two SKUs for your premium offering. For integration and testing entitlements, you should use the SKU with type: 5.

Parameters
FieldTypeDescription
application_id?snowflakethe id of the application
Example
await mapih.discord.applications.SKUs.getAll();

Audit Logs

MethodDescription
retrieveGet the audit logs for the guild

Get Guild Audit Log

The returned list of audit log entries is ordered based on whether you use before or after. When using before, the list is ordered by the audit log entry ID descending (newer entries first). If after is used, the list is reversed and appears in ascending order (older entries first). Omitting both before and after defaults to before the current timestamp and will show the most recent entries in descending order by ID, the opposite can be achieved using after=0 (showing oldest entries).

Parameters
FieldTypeDescription
guild_idsnowflakethe id of the application
user_id?snowflakeEntries from a specific user ID
action_type?numberEntries for a specific audit log event
before?snowflakeEntries with ID less than a specific audit log entry ID
after?snowflakeEntries with ID greater than a specific audit log entry ID
limit?numberMaximum number of entries (between 1-100) to return, defaults to 50
Example
await mapih.discord.auditlog.retrieve({
  guild_id: '0000000000',
  user_id: '0000000000',
  limit: 10 // default 50
});

Auto Moderation

MethodDescription
retrieveRuleGet an auto moderation rule
getAllRulesGet all auto moderation rules
createRuleCreate a new auto moderation rule
updateRuleUpdate an auto moderation rule
destroyRuleDelete an auto moderation rule

Get Auto Moderation Rule

Parameters
FieldTypeDescription
guild_idsnowflakethe id of the guild
auto_moderation_rule_idsnowflakethe id of the automod rule
Example
await mapih.discord.automod.retrieveRule({
  auto_moderation_rule_id: '0000000000',
  guild_id: '0000000000'
})

List Auto Moderation Rules

Parameters
FieldTypeDescription
guild_idsnowflakethe id of the guild
Example
await mapih.discord.automod.getAll({
  guild_id: '0000000000'
})

Create Auto Moderation Rule

Parameters
FieldTypeDescription
guild_idsnowflakethe id of the guild
namestringthe rule name
event_typeintegerthe event type
trigger_typeintegerthe trigger type
trigger_metadata? *objectthe trigger metadata
actionsarray of action objectsthe actions which will execute when the rule is triggered
enabled?booleanwhether the rule is enabled (False by default)
exempt_roles?array of snowflakesthe role ids that should not be affected by the rule (Max 20)
exempt_channels?array of snowflakesthe channel ids that should not be affected by the rule (Max 50)
Example
await mapih.discord.automod.createRule({
  guild_id: '0000000000',
  name: 'EricsAutoModRule',
  event_type: 1 // MESSAGE_SEND
  trigger_type: 3 // SPAM
  actions: [{
    type: 2, // SEND_ALERT_MESSAGE
    metadata: { channel_id: '0000000000' }
  }],
  enabled: true,
  exempt_roles: ['0000000000'],
  exempt_channels: ['0000000000']
})

Modify Auto Moderation Rule

Parameters
FieldTypeDescription
guild_idsnowflakethe id of the guild
namestringthe rule name
event_typeintegerthe event type
trigger_metadata? *objectthe trigger metadata
actionsarray of action objectsthe actions which will execute when the rule is triggered
enabled?booleanwhether the rule is enabled (False by default)
exempt_roles?array of snowflakesthe role ids that should not be affected by the rule (Max 20)
exempt_channels?array of snowflakesthe channel ids that should not be affected by the rule (Max 50)
Example
await mapih.discord.automod.updateRule({
  guild_id: '0000000000',
  auto_moderation_rule_id: '00000',
   name: 'EricsAutoModRule',
   event_type: 1 // MESSAGE_SEND
   actions: [{
     type: 1, // BLOCK_MESSAGE
     metadata: { custom_message: 'GO AWAY' }
   }],
   trigger_metadata: {
     keyword_filter: ['cat*', '*dog'],
     regex_patterns: ['^(?:[0-9]{1,3}\\.){3}[0-9]{1,3}$']
   },
   enabled: true
})

Delete Auto Moderation Rule

Parameters
FieldTypeDescription
guild_idsnowflakethe id of the guild
auto_moderation_rule_idsnowflakethe id of the automod rule
Example
await mapih.discord.automod.destroyRule({
  auto_moderation_rule_id: '0000000000',
  guild_id: '0000000000'
})

Stage Instance

A Stage Instance holds information about a live stage.

Endpoints

MethodDescription
retrieveGets the stage instance associated with the Stage channel
createCreates a new Stage instance associated to a Stage channel
updateUpdates fields of an existing Stage instance
destroyDeletes the Stage instance

Get Stage Instance

Parameters
FieldTypeDescription
channel_idsnowflakethe id of the channel that the stage instance is in
Example
await mapih.discord.stageInstance.retrieve({
  channel_id: '0000000000'
});

Create Stage Instance

Parameters
FieldTypeDescription
channel_idsnowflakeThe id of the Stage channel
topicstringThe topic of the Stage instance (1-120 characters)
privacy_level?integerThe privacy level of the Stage instance (default GUILD_ONLY)
send_start_notification? *booleanNotify @everyone that a Stage instance has started
guild_scheduled_event_id?snowflakeThe guild scheduled event associated with this Stage instance

* The stage moderator must have the MENTION_EVERYONE permission for this notification to be sent.

Example
await mapih.discord.stageInstance.create({
  channel_id: '0000000000',
  topic: 'My super cool stage',
  send_start_notification: true
});

Modify Stage Instance

Parameters
FieldTypeDescription
channel_idsnowflakeThe id of the Stage channel
topic?stringThe topic of the Stage instance (1-120 characters)
privacy_level?integerThe privacy level of the Stage instance (default GUILD_ONLY)
Example
await mapih.discord.stageInstance.update({
  channel_id: '0000000000',
  topic: 'My super duper cool stage',
});

Delete Stage Instance

Parameters
FieldTypeDescription
channel_idsnowflakethe id of the channel that the stage instance is in
Example
await mapih.discord.stageInstance.destroy({
  channel_id: '0000000000'
});

OpenAI


Chat

Methods

MethodDescription
createCreat a chat completion

Create Chat Completion

Parameters
FieldTypeDescription
modelstringID of the model to use
messagesChatCompletionMessage[]A list of messages comprising the conversation so far
max_tokens?numberThe maximum number of tokens that can be generated in the chat completion
temperature?numberWhat sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.
top_p?numberAn alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.
frequency_penalty?numberNumber between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim.
presence_penalty?numberNumber between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics.
n?numberHow many chat completion choices to generate for each input message
response_format?stringAn object specifying the format that the model must output. Setting to { "type": "json_object" } enables JSON mode, which guarantees the message the model generates is valid JSON.
seed?numberThis feature is in Beta. If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result.
stop?stringUp to 4 sequences where the API will stop generating further tokens
logit_bias?ObjectModify the likelihood of specified tokens appearing in the completion. Accepts a JSON object that maps tokens (specified by their token ID in the tokenizer) to an associated bias value from -100 to 100.
logprobs?booleanWhether to return log probabilities of the output tokens or not
top_logprobs?numberAn integer between 0 and 5 specifying the number of most likely tokens to return at each token position, each with an associated log probability
stream?booleanIf set, partial message deltas will be sent, like in ChatGPT.
tools?ToolCalls[]A list of tools the model may call. Currently, only functions are supported as a tool. Use this to provide a list of functions the model may generate JSON inputs for.
tool_choice?ToolChoiceControls which (if any) function is called by the model. See tool_choice
user?stringA unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse
Example
await mapih.openai.chat.create({
  model: 'gpt-4',
  messages: [
    {
      role: 'system',
      content: 'You are a chatbot'
    },
    {
      role: 'user',
      content: 'hello!'
    }
  ],
  max_tokens: 1024,
  temperature: 0.7
});

Spotify

Many of the Spotify endpoints are designed for the input of a specific Spotify ID.

However, I have also incorporated the functionality to accept names. Each endpoint includes options for both the ID* and the name**. Utilizing a specific ID ensures the retrieval of the correct item. On the other hand, providing a name might result in incorrect items depending on the uniqueness of the name.

* song_id(s), artist_id(s), album_id(s), playlist_id(s) ** song_name(s), artist_name(s), album_name(s), playlist_name(s)


Users

Methods

MethodDescription
meGet detailed profile information about the current user
topItemsGet the current user's top artists or tracks
getProfileGet public profile information about a Spotify user

Get Current User's Profile

Example
await mapih.spotify.users.me();

Get User's Top Items

Parameters
FieldTypeDescription
typestringThe type of entity to return (artists or tracks)
time_range? *stringOver what time frame the affinities are computed (default medium_term)
limit?numberThe maximum number of results to return
offset?numberThe index of the first result to return. Use with limit to get the next page of search results.

* Valid values for time_range:

  • long_term: calculated from several years of data and including all new data as it becomes available
  • medium_term: approximately last 6 months
  • short_term: approximately last 4 weeks
Example
await mapih.spotify.users.topItems({
  type: 'tracks',
  time_range: 'long_term',
  limit: 10
});

Get User's Profile

Parameters
FieldTypeDescription
user_idstringThe user's Spotify user ID
Example
await mapih.spotify.users.getProfile({
  user_id: 'smedjan'
});

Methods

MethodDescription
advancedExtensive search for songs, artists, albums
artistsSearch for artists
songsSearch for songs
albumsSearch for albums
Parameters
FieldTypeDescription
song? *stringSong name to search for
artist? *stringArtist name to search for
album? *stringAlbum name to search for
include?string[]Type of results to include. One or more of songs, artists, albums.
limit?numberThe maximum number of results to return
offset?numberThe index of the first result to return. Use with limit to get the next page of search results.
sort?stringSort results by: popularity, followers, or duration_seconds
year?stringFilter on a single year or a range (e.g. 1955-1960)
genre?stringFilter on a single genre

* At least one of song, artist, album is required.

Example 1
await mapih.spotify.search.advanced({
  song: 'oops i did it again',
  year: '1990-1995',
  limit: 1
});
Example 2
await mapih.spotify.search.advanced({
  song: 'some popular song name',
  limit: 10,
  sort: 'popularity'
});
Example 3
await mapih.spotify.search.advanced({
  album: 'your favorite album name',
  include: ['albums'],
});

Search Artists

Parameters
FieldTypeDescription
artiststringArtist name to search for
limit?numberThe maximum number of results to return
offset?numberThe index of the first result to return. Use with limit to get the next page of search results.
sort?stringSort results by: popularity or followers
Example 1
await mapih.spotify.search.artists('artist name');
Example 2
await mapih.spotify.search.artists('artist name', {
  limit: 10,
  sort: 'popularity'
});

Search Songs

Parameters
FieldTypeDescription
songstringSong name to search for
limit?numberThe maximum number of results to return
offset?numberThe index of the first result to return. Use with limit to get the next page of search results.
sort?stringSort results by: popularity, followers, or duration_seconds
Example 1
await mapih.spotify.search.songs('song name');
Example 2
await mapih.spotify.search.songs('song name', {
  limit: 10,
  sort: 'popularity'
});

Songs

Methods

MethodDescription
retrieveGet Spotify catalog information for a single song
retrieveManyGet Spotify catalog information for multiple songs
recommendationsGet song recommendations
saveSave one or more songs to the current user's 'Your Music' library
unsaveRemove one or more songs from the current user's 'Your Music' library
savedGet a list of the songs saved in the current Spotify user's 'Your Music' library
isSavedCheck if one or more tracks is already saved in the current Spotify user's 'Your Music' library
analyzeGet a low-level audio analysis for a song in the Spotify catalog
audioFeaturesGet audio feature information for a single song
audioFeaturesManyGet audio feature information for multiple songs

Get Song

Parameters
FieldTypeDescription
song_id?stringThe id of the song to retrieve
song_name?stringThe name of the song to search for
Example
await mapih.spotify.songs.retrieve({
  song_name: 'Satellites'
  // song_id: '4B9El4lQqztivDlRUCxbZB''
});

Get Several Songs

Parameters
FieldTypeDescription
song_ids?string[]The ids of the songs to retrieve
song_names?string[]The names of the songs to search for
sort?stringSort results by: popularity, followers, or duration_seconds
Example
await mapih.spotify.songs.retrieveMany({
  song_names: ['song 1', 'song 2'],
  // song_ids: ['id 1', 'id 2']
});

Get Recommendations

Parameters
FieldTypeDescription
songs? *stringSong name to search for
artists? *stringArtist name to search for
genres?stringGenres to include
limit?numberThe maximum number of results to return
min_acousticness?number
max_acousticness?number
target_acousticness?number
min_danceability?number
max_danceability?number
target_danceability?number
min_duration_ms?number
max_duration_ms?number
target_duration_ms?number
min_energy?number
target_energy?number
min_instrumentalness?number
max_instrumentalness?number
target_instrumentalness?number
min_key?number
max_key?number
target_key?number
min_liveness?number
max_livenessc?number
target_liveness?number
min_loudness?number
max_loudness?number
target_loudness?number
min_mode?number
max_mode?number
target_mode?number
min_popularity?number
max_popularity?number
target_popularity?number
min_speechiness?number
max_speechiness?number
target_speechiness?number
min_tempo?number
max_tempo?number
target_tempo?number
min_time_signature?number
max_time_signature?number
target_time_signature?number
min_valence?number
max_valence?number
target_valence?number
Example
await mapih.spotify.songs.recommendations({
  artists: ['artist name', 'another name'],
  songs: ['song name'],
  limit: 5,
  min_duration_ms: 5000
});

Save Song

Parameters
FieldTypeDescription
song_names?string[]Song names to search and save to your library
song_ids?string[]Song IDs of songs to save to your library
Example
await mapih.spotify.songs.save({
  song_names: [
    'song name',
    'another song name'
  ]
  // song_ids: ['id 1', 'id 2']
});

Remove Song

Parameters
FieldTypeDescription
song_names?string[]Song names to search and remove from your library
song_ids?string[]Song IDs of songs to remove from your library
Example
await mapih.spotify.songs.unsave({
  song_names: [
    'song name',
    'another song name'
  ]
  // song_ids: ['id 1', 'id 2']
});

Get User's Saved Songs

Parameters
FieldTypeDescription
limit?numberThe maximum number of results to return
offset?numberThe index of the first result to return. Use with limit to get the next page of search results.
sort?stringSort results by: popularity, followers, or duration_seconds
Example
await mapih.spotify.songs.saved();

Check User's Saved Songs

Parameters
FieldTypeDescription
song_names?string[]Song names to search and check if user follows
song_ids?string[]Song IDs of songs to check if user follows
Example
await mapih.spotify.songs.isSaved({
  song_names: [
    'song name',
    'another song name'
  ]
  // song_ids: ['id 1', 'id 2']
});

Analyze Song

Parameters
FieldTypeDescription
song_name?stringSong name to search and analyze
song_id?stringSong ID of song to analyze
Example
await mapih.spotify.songs.analyze({
  song_name: 'song name'
  // song_id: 'id 1'
});

Get Audio Features

Parameters
FieldTypeDescription
song_name?stringSong name to search and retrieve features for
song_id?stringSong ID of song to retrieve features for
Example
await mapih.spotify.songs.audioFeatures({
  song_name: 'song name'
  // song_id: 'id 1'
});

Get Several Audio Features

Parameters
FieldTypeDescription
song_names?string[]Song names to search and retrieve features for
song_ids?string[]Song IDs of songs to retrieve features for
Example
await mapih.spotify.songs.audioFeaturesMany({
  song_names: [
    'song name',
    'another song name'
  ]
  // song_ids: ['id 1', 'id 2']
});

Artists

Methods

MethodDescription
retrieveGet Spotify catalog information for a single artist
retrieveManyGet Spotify catalog information for multiple artists
topSongsGet Spotify catalog information about an artist's top songs
albumsGet Spotify catalog information about an artist's albums
relatedGet Spotify catalog information about artists similar to a given artist
followAdd the current user as a follower of one or more artists or other Spotify users
unfollowRemove the current user as a follower of one or more artists or other Spotify users
followingGet the current user's followed artists
isFollowingCheck to see if the current user is following one or more artists or other Spotify users

Get Artist

Parameters
FieldTypeDescription
artist_id?stringThe id of the song to retrieve
artist_name?stringThe name of the song to search for
Example
await mapih.spotify.artists.retrieve({
  artist_name: 'artist name'
  // artist_id: '0uZ8zQLHru4BiNTL2PQY91'
});

Get Several Artists

Parameters
FieldTypeDescription
artist_ids?string[]The ids of the artists to retrieve
artist_names?string[]The names of the artists to search for
sort?stringSort results by: popularity or followers
Example
await mapih.spotify.artists.retrieveMany({
  artist_names: ['artist 1', 'artist 2'],
  // artists_ids: ['id 1', 'id 2']
});

Get Artists Top Songs

Parameters
FieldTypeDescription
artist_id?stringThe id of the artist to retrieve top songs for
artist_name?stringThe name of the artist to search for
limit?numberThe maximum number of results to return
Example
await mapih.spotify.artists.topSongs({
  artist_name: 'artist name',
  // artists_id: 'artist id',
  limit: 5
});

Get Artists Albums

Parameters
FieldTypeDescription
artist_id?stringThe id of the artist to retrieve albums for
artist_name?stringThe name of the artist to search for
limit?numberThe maximum number of results to return
offset?numberThe index of the first result to return. Use with limit to get the next page of search results.
include_groups? *string[]One or more keywords that will be used to filter the response

* Valid values: album, single, appears_on, compilation

Example
await mapih.spotify.artists.albums({
  artist_name: 'artist name',
  // artists_id: 'artist id',
  limit: 5,
  include_groups: ['single', 'appears_on']
});
Parameters
FieldTypeDescription
artist_id?stringThe id of the artist to get related artists for
artist_name?stringThe name of the artist to search for
Example
await mapih.spotify.artists.related({
  artist_name: 'artist name',
  // artists_id: 'artist id',
});

Follow Artists or Users

Parameters
FieldTypeDescription
artist_ids?string[]The ids of the artists or users to follow
artist_names?string[]The names of the artists or users to search for and follow
type?stringEither artist or user (default artist)
Example
await mapih.spotify.artists.follow({
  type: 'artist',
  artist_names: [
    'artist name',
    'another artist name'
  ]
  // artist_ids: ['id 1', 'id 2']
});

Unfollow Artists or Users

Parameters
FieldTypeDescription
artist_ids?string[]The ids of the artists or users to unfollow
artist_names?string[]The names of the artists or users to search for and unfollow
type?stringEither artist or user (default artist)
Example
await mapih.spotify.artists.unfollow({
  type: 'artist',
  artist_names: [
    'artist name',
    'another artist name'
  ]
  // artist_ids: ['id 1', 'id 2']
});

Get Followed Artists

Parameters
FieldTypeDescription
after?stringThe last artist ID retrieved from the previous request
limit?numberThe maximum number of results to return (default 20)
sort?stringSort results by: popularity or followers
Example 1
await mapih.spotify.artists.following();

Check Followed Artists or Users

Parameters
FieldTypeDescription
artist_ids?string[]The ids of the artists or users to unfollow
artist_names?string[]The names of the artists or users to search for and unfollow
type?stringEither artist or user (default artist)
Example
await mapih.spotify.artists.isFollowing({
  type: 'artist',
  artist_names: [
    'artist name',
    'another artist name'
  ]
  // artist_ids: ['id 1', 'id 2']
});

Albums

Methods

MethodDescription
retrieveGet Spotify catalog information for a single album
retrieveManyGet Spotify catalog information for multiple albums
songsGet Spotify catalog information about an album’s tracks
newGet a list of new album releases featured in Spotify
saveSave one or more albums to the current user's 'Your Music' library
unsaveRemove one or more albums from the current user's 'Your Music' library
savedGet a list of the albums saved in the current Spotify user's 'Your Music' library
isSavedCheck if one or more albums is already saved in the current Spotify user's 'Your Music' library

Get Album

Parameters
FieldTypeDescription
album_id?stringThe id of the album to retrieve
album_name?stringThe name of the album to search for
Example
await mapih.spotify.albums.retrieve({
  album_name: 'album name'
  // album_id: '0uZ8zQLHru4BiNTL2PQY91'
});

Get Several Albums

Parameters
FieldTypeDescription
album_ids?string[]The ids of the albums to retrieve
album_names?string[]The names of the albums to search for
sort?stringSort results by: popularity, or followers
Example
await mapih.spotify.albums.retrieveMany({
  album_names: ['album 1', 'album 2'],
  // album_ids: ['id 1', 'id 2']
});

Get Album Songs

Parameters
FieldTypeDescription
album_id?stringThe id of the album to retrieve
album_name?stringThe name of the album to search for
limit?numberThe maximum number of results to return
offset?numberThe index of the first result to return. Use with limit to get the next page of search results.
Example
await mapih.spotify.albums.songs({
  album_name: 'album name'
  // album_id: '0uZ8zQLHru4BiNTL2PQY91'
});

Get New Releases

Parameters
FieldTypeDescription
limit?numberThe maximum number of results to return
offset?numberThe index of the first result to return. Use with limit to get the next page of search results.
Example 1
await mapih.spotify.albums.new();
Example 2
await mapih.spotify.albums.new({
  limit: 5
});

Save Album

Parameters
FieldTypeDescription
album_names?string[]Album names to search and save to your library
album_ids?string[]Album IDs of songs to save to your library
Example
await mapih.spotify.albums.save({
  album_names: [
    'album name',
    'another album name'
  ]
  // album_ids: ['id 1', 'id 2']
});

Remove Album

Parameters
FieldTypeDescription
album_names?string[]Album names to search and remove from your library
album_ids?string[]Album IDs of albums to remove from your library
Example
await mapih.spotify.albums.unsave({
  album_names: [
    'album name',
    'another album name'
  ]
  // album_ids: ['id 1', 'id 2']
});

Get User's Saved Albums

Parameters
FieldTypeDescription
limit?numberThe maximum number of results to return
offset?numberThe index of the first result to return. Use with limit to get the next page of search results.
sort?stringSort results by: popularity or followers
Example
await mapih.spotify.albums.saved();

Check User's Saved Albums

Parameters
FieldTypeDescription
album_names?string[]Album names to search and check if user follows
album_ids?string[]Album IDs of albums to check if user follows
Example
await mapih.spotify.albums.isSaved({
  album_names: [
    'album name',
    'another album name'
  ]
  // album_ids: ['id 1', 'id 2']
});

Playlists

Methods

MethodDescription
featuredGet a list of Spotify featured playlists
categoryGet a list of Spotify playlists tagged with a particular category
createCreate a playlist for a Spotify user
updateChange a playlist's name and public/private state
addSongsAdd one or more items to a user's playlist
updateSongsEither reorder or replace items in a playlist depending on the request's parameters
removeSongsRemove one or more items from a user's playlist
retrieveSongsGet full details of the items of a playlist owned by a Spotify user
createdGet a list of Spotify playlists that the user has created
followingGet a list of the playlists owned or followed by the current Spotify user
userGet a list of the playlists owned or followed by a Spotify user
isFollowingCheck to see if one or more Spotify users are following a specified playlist
followAdd the current user as a follower of a playlist
unfollowRemove the current user as a follower of a playlist
getCoverGet the current image associated with a specific playlist
updateCoverReplace the image used to represent a specific playlist
Parameters
FieldTypeDescription
limit?numberThe maximum number of results to return
offset?numberThe index of the first result to return. Use with limit to get the next page of search results.
Example 1
await mapih.spotify.playlists.featured();
Example 2
await mapih.spotify.playlists.featured({
  limit: 5
});

Get Categories Playlists

Parameters
FieldTypeDescription
categorystringThe category to get playlists for
limit?numberThe maximum number of results to return
offset?numberThe index of the first result to return. Use with limit to get the next page of search results.
Example 1
await mapih.spotify.playlists.featured('party');
Example 2
await mapih.spotify.playlists.featured('party', {
  limit: 5
});

Create Playlist

Parameters
FieldTypeDescription
namestringThe name for the new playlist
description?stringThe description for the new playlist
public?booleanWhether or not the playlist should be public
collaborative?booleanWhether or not the playlist should be collaborative
Example
await mapih.spotify.playlists.create({
  name: 'My new playlist',
  public: false
});

Change Playlist Details

Parameters
FieldTypeDescription
playlist_idstringThe Spotify ID of the playlist
name?stringThe name for the new playlist
description?stringThe description for the new playlist
public?booleanWhether or not the playlist should be public
collaborative?booleanWhether or not the playlist should be collaborative
Example
await mapih.spotify.playlists.update({
  playlist_id: '3cEYpjA9oz9GiPac4AsH4n',
  name: 'My new old playlist',
  public: true
});

Add Songs To Playlist

Parameters
FieldTypeDescription
playlist_idstringThe Spotify ID of the playlist
uris?string[]An array of Spotify URIs to add
position?numberThe position to insert the items, a zero-based index
Example
await mapih.spotify.playlists.addSongs({
  playlist_id: '3cEYpjA9oz9GiPac4AsH4n',
  uris: [
    '4iV5W9uYEdYUVa79Axb7Rh',
    '1301WleyT98MSxVHPZCA6M'
  ]
});

Update Playlist Songs

Parameters
FieldTypeDescription
playlist_idstringThe Spotify ID of the playlist
uris?string[]An array of Spotify URIs to add
range_start?numberThe position of the first item to be reordered
range_length?numberThe amount of items to be reordered
insert_before?numberThe position where the items should be inserted
snapshot_id?stringThe playlist's snapshot ID against which you want to make the changes
Example
await mapih.spotify.playlists.updateSongs({
  playlist_id: '3cEYpjA9oz9GiPac4AsH4n',
  uris: [
    '4iV5W9uYEdYUVa79Axb7Rh',
    '1301WleyT98MSxVHPZCA6M'
  ]
});

Remove Songs From Playlist

Parameters
FieldTypeDescription
playlist_idstringThe Spotify ID of the playlist
uris?string[]An array of Spotify URIs to remove
snapshot_id?stringThe playlist's snapshot ID against which you want to make the changes
Example
await mapih.spotify.playlists.removeSongs({
  playlist_id: '3cEYpjA9oz9GiPac4AsH4n',
  uris: [
    '4iV5W9uYEdYUVa79Axb7Rh',
    '1301WleyT98MSxVHPZCA6M'
  ]
});

Get Playlist Songs

Parameters
FieldTypeDescription
playlist_idstringThe Spotify ID of the playlist
fields?any[]Filters for the query
limit?numberThe maximum number of results to return
offset?numberThe index of the first result to return. Use with limit to get the next page of search results.
Example 1
// Get just the `name` and `description`
await mapih.spotify.playlists.retrieveSongs({
  playlist_id: '3cEYpjA9oz9GiPac4AsH4n',
  fields: ['name', 'description']
});
Example 2
// Get just the `added_at` field of the track
await mapih.spotify.playlists.retrieveSongs({
  playlist_id: '3cEYpjA9oz9GiPac4AsH4n',
  fields: {
    tracks: {
      items: ['added_at']
    }
  }
});
Example 3
// Get the `name` and `id` of the track and the `name` and `artists` of the album that the track is on
await mapih.spotify.playlists.retrieveSongs({
  playlist_id: '3cEYpjA9oz9GiPac4AsH4n',
  fields: {
    tracks: {
      items: [{
        track: ['name', 'id', {
          album: ['name', 'artists']
        }]
      }]
    }
  }
});

Get Current User's Created Playlists

This will only return playlists created by the current user.

Parameters
FieldTypeDescription
limit?booleanThe maximum number of items to return (default 20, max 50)
offset?booleanThe index of the first playlist to return
Example 1
await mapih.spotify.playlists.created();
Example 2
await mapih.spotify.playlists.created({
  limit: 5
});

Get Current User's Playlists

This will return all playlists the current user follows.

Parameters
FieldTypeDescription
limit?booleanThe maximum number of items to return (default 20, max 50)
offset?booleanThe index of the first playlist to return
Example 1
await mapih.spotify.playlists.following();
Example 2
await mapih.spotify.playlists.following({
  limit: 5
});

Get User's Playlists

This will return all playlists a specific user follows

Parameters
FieldTypeDescription
user_idstringThe user's Spotify user ID
limit?booleanThe maximum number of items to return (default 20, max 50)
offset?booleanThe index of the first playlist to return
Example
await mapih.spotify.playlists.following({
  user_id: 'smedjan',
  limit: 5
});

Check If User Follows Playlists

Parameters
FieldTypeDescription
playlist_idstringThe Spotify ID of the playlist
user_idsstring[]The user_ids of the users that you want to check to see if they follow the playlist
Example
await mapih.spotify.playlists.isFollowing({
  playlist_id: '3cEYpjA9oz9GiPac4AsH4n',
  user_ids: [
    'smedjan',
    'jmperezperez'
  ]
});

Follow Playlist

Parameters
FieldTypeDescription
playlist_idstringThe Spotify ID of the playlist
public?booleanWhether the playlist will be included in user's public playlists (default true)
Example
await mapih.spotify.playlists.follow({
  playlist_id: '3cEYpjA9oz9GiPac4AsH4n',
  public: false
});

Unfollow Playlist

Parameters
FieldTypeDescription
playlist_idstringThe Spotify ID of the playlist
Example
await mapih.spotify.playlists.unfollow({
  playlist_id: '3cEYpjA9oz9GiPac4AsH4n'
});

Get Playlists Cover Image

Parameters
FieldTypeDescription
playlist_idstringThe Spotify ID of the playlist
Example
await mapih.spotify.playlists.getCover({
  playlist_id: '3cEYpjA9oz9GiPac4AsH4n'
});

Add Playlist Cover Image

Parameters
FieldTypeDescription
playlist_idstringThe Spotify ID of the playlist
imagestringBase64 encoded JPEG image data
Example
await mapih.spotify.playlists.updateCover({
  playlist_id: '3cEYpjA9oz9GiPac4AsH4n',
  image: 'image data'
});

Playback

Methods

MethodDescription
stateGet information about the user’s current playback state
currentSongGet the object currently being played on the user's Spotify account
devicesGet information about a user’s available Spotify Connect devices
togglePlaybackStart a new context or resume current playback on the user's active device
pausePause playback on the user's account
skipSkips to next track in the user’s queue
previousSkips to previous track in the user’s queue
seekSeeks to the given position in the user’s currently playing track
setVolumeSet the volume for the user’s current playback device
toggleShuffleToggle shuffle on or off for user’s playback
toggleRepeatSet the repeat mode for the user's playback
queueGet the list of objects that make up the user's queue
addToQueueAdd an item to the end of the user's current playback queue
recentGet tracks from the current user's recently played tracks
transferTransfer playback to a new device and optionally begin playback

Get Playback State

Example
await mapih.spotify.playback.state();

Get Currently Playing Song

Example
await mapih.spotify.playback.currentSong();

Get Available Devices

Example
await mapih.spotify.playback.devices();

Start/Resume Playback

Parameters
FieldTypeDescription
song_ids?string[]Array of Spotify track IDs to play
context_uri?stringSpotify URI of the context to play. Valid contexts are albums, artists & playlists.
Example 1
await mapih.spotify.playback.togglePlayback();
Example 2
await mapih.spotify.playback.togglePlayback({
  song_ids: ['1301WleyT98MSxVHPZCA6M']
})
Example 3
await mapih.spotify.playback.togglePlayback({
  context_uri: 'spotify:album:1Je1IMUlBXcx1Fz0WE7oPT'
})

Pause Playback

Example
await mapih.spotify.playback.pause();

Skip To Next Song

Example
await mapih.spotify.playback.skip();

Skip To Previos Song

Example
await mapih.spotify.playback.previos();

Seek To Position

Parameters
FieldTypeDescription
position_msnumberThe position in milliseconds to seek to
Example
await mapih.spotify.playback.seek({
  position_ms: 25000
});

Set Playback Volume

Parameters
FieldTypeDescription
volume_percentnumberThe volume to set (0-100)
Example
await mapih.spotify.playback.setVolume({
  volume_percent: 100
});

Toggle Playback Shuffle

Parameters

* This endpoint takes a boolean (true to turn shuffle on, false to turn shuffle off)

Example
await mapih.spotify.playback.toggleShuffle(true);

Set Repeat Mode

Parameters

* This endpoint takes a string with the mode to set Valid values:

  • track: will repeat the current track
  • context: will repeat the current context (album, playlist)
  • off: will turn repeat off
Example
await mapih.spotify.playback.toggleRepeat('track');

Get User's Queue

Example
await mapih.spotify.playback.queue();

Add Item To Queue

Parameters
FieldTypeDescription
song_idstringThe Spotify ID of the song to add to the queue
Example
await mapih.spotify.playback.addToQueue({
  song_id: '4iV5W9uYEdYUVa79Axb7Rh'
});

Get Recently Played Songs

Example
await mapih.spotify.playback.recent();

Transfer Playback

Parameters
FieldTypeDescription
device_idstringThe Spotify ID of the song to add to the queue
play?booleanWhether playback starts on new device or if current state is kept
Example
await mapih.spotify.playback.transfer({
  device_id: '74ASZWbe4lXaubB36ztrGX',
  play: 'false'
});

Utils

Storage

Simple key/value persistent storage

MethodDescription
setCreates an entry with a set value
setManyCreates multiple entries at a time
getRetrieves the value of a stored key
getManyRetrieves a key-value pair of multiple entries
deleteDeletes an entry
deleteManyDeletes multiple entries at a time
mergeMerge object into an existing value's object
pushPush values into an existing value's array
exportExport storage with mapped keys to values
filterFilter storage with given predicate
allRetrieve all stored items
hasChecks if storage has a specified key
entriesGet storage's entries
keysGet storage's keys
valuesGet storage's values
sizeGet the amount of entries in storage
bytesGet the total size (in bytes) of storage
keysExport storage as a JSON string
clearClear all entries from storage
equalsCheck if specified key's value equals specified value
historyRetrieve a keys previous values with timestamps
clearHistoryClear one or all entries in a key's history

Storage Set

Parameters
FieldTypeDescription
keystringThe key to assign a value
valueanyThe value to assign to a key
tts?numberAmount of time in ms that this value will be stored
ttlCb?functionA function to invoke upon expiration
allow_overwrite?booleanWhether to allow this key's value to be overwritten
Example 1
await mapih.utils.storage.set({
  key: 'password',
  value: 'abcd1234'
});
Example 2
await mapih.utils.storage.set({
  key: 'password',
  value: 'abcd1234',
  ttl: 5000, // 5 seconds
  ttlCb: () => console.log('password expired')
});
Example 3
await mapih.utils.storage.set({
  key: 'password',
  value: 'abcd1234',
  allow_overwrite: false
});

await mapih.utils.storage.set({
  key: 'password',
  value: 'newvalue',
}); //=> error

Storage Set Many

Parameters
FieldTypeDescription
keystringThe key to retrieve the value for
valueanyThe value to assign to a key
Example
await mapih.utils.storage.setMany({
  keyname1: 'value1',
  keyname2: 'value2',
  keyname3: 'value3'
})

Storage Get

Parameters
FieldTypeDescription
keystringThe key to assign the value
default?booleanDefault value to assign a key if an entry doesn't exist
delete?booleanWhether to delete this entry after retrieving the value
Example
await mapih.utils.storage.get('password'); //=> 'abcd1234'
Example 2
// Set default value if value doesn't exist
await mapih.utils.storage.get('password', {
  default: 'defaultValue'
}); //=> 'defaultValue'
Example 3
// Delete entry after retrieving the value
await mapih.utils.storage.get('password', {
  delete: true
}); //=> 'defaultValue'

await mapih.utils.storage.get('password'); //=> null

Storage Get Many

Parameters
FieldTypeDescription
keysArray of stringsAn array of keys to retrieve values for
Example
await mapih.utils.storage.getMany(['password', 'password2', 'password3'])
//=> { password: 'abc123', password2: '123abc', password3: undefined }

Storage Delete

Parameters
FieldTypeDescription
keystringThe key of the entry to delete
Example
await mapih.utils.storage.delete('password');

Storage Delete Many

Parameters
FieldTypeDescription
keysArray of stringsAn array of keys to delete the entries for
Example
await mapih.utils.storage.deleteMany(['password', 'password2', 'password3'])
//=> [true, true, false]

Storage Merge

Parameters
FieldTypeDescription
keystringThe key of the entry to alter
valueObjectThe properties to merge into existing object

* Value must be an object

Example
await mapih.utils.storage.set({
  key: 'example',
  value: { a: 'b' }
});

await mapih.utils.storage.merge('example', { c: 'd' });
//=> new value: { a: 'b', c: 'd' }

await mapih.utils.storage.merge('example', { a: 'z' });
//=> new value: { a: 'z', c: 'd' }

Storage Push

Parameters
FieldTypeDescription
keystringThe key of the entry to alter
value...anyComma delimited set of values to push into the existing array
Example
await mapih.utils.storage.set({
  key: 'array',
  value: [1, 2]
});

await mapih.utils.storage.push('array', 3, 4);
//=> new value: [1, 2, 3, 4]

await mapih.utils.storage.push('array', [5, 6], 7);
//=> new value: [ 1, 2, [ 5, 6 ], 7 ]

// keep duplicates
await mapih.utils.storage.push('array', 1, 7);
//=> new value: [ 1, 2, [ 5, 6 ], 7, 1, 7 ]

// filter out duplicates
await mapih.utils.storage.push('array', 1, 7, {
  unique: true
});
//=> new value: [ 1, 2, [ 5, 6 ], 7 ]

Storage Export

Example
mapih.utils.storage.export();
//=> {"password": {"value": "abcd1234"}}

Storage Filter

Parameters
FieldTypeDescription
predicateCallbackThe callback to invoke
Example
mapih.utils.storage.filter((x) => x.key.includes('ass'));
//=> [{ key: 'password', value: 'abc123' }]

Storage All

Example
mapih.utils.storage.all();
//=>
// [
//   { key: 'array', value: [ 1, 2, [Array], 7 ] },
//   { key: 'password', value: 'abc123' }
// ]

Storage Has

Parameters
FieldTypeDescription
keystringThe key to check
Example
mapih.utils.storage.has('password');

Storage Entries

Example
mapih.utils.storage.entries();
//=> [ [ 'password', 'abcd1234' ], [ 'test', '4321dcba' ] ]

Storage Keys

Example
mapih.utils.storage.keys();
//=> ['password', 'stuff']

Storage Values

Example
mapih.utils.storage.keys();
//=> ['password', 'stuff']

Storage Size

Example
mapih.utils.storage.size(); // 3

Storage Bytes

Example
mapih.utils.storage.bytes(); // 23235 (bytes)

Storage toJson

Example
mapih.utils.storage.toJson();
//=> [{"key":"array","value":[1,2,[5,6],7]},{"key":"password","value":"abc123"}]

Storage Clear

Example
await mapih.utils.storage.clear(); // undefined

Storage Equals

Parameters
FieldTypeDescription
keystringThe key of the entry to check the value for
valueanyThe value to compare
Example
mapih.utils.storage.equals('password', 'abcd1234'); // true

Storage History

Parameters
FieldTypeDescription
keystringThe key of the entry to get the history of
Example
mapih.utils.storage.history('password');
//=>
// [
//   { value: 'abcd1234', timestamp: 1703037628164 },
//   { value: '4321dcba', timestamp: 1703037861827 },
//   { value: '1234abcd', timestamp: 1703037890201 },
// ]

Storage Clear History

Parameters
FieldTypeDescription
key?stringThe key of the entry to delete, optional
Example
// Clear history for a specific key
mapih.utils.storage.clearHistory('password');

// Clear all entries in history
mapih.utils.storage.clearHistory();

Discord Objects and Types

Guild

Guild Object
FieldTypeDescription
idsnowflakeguild id
namestringguild name (2-100 characters, excluding trailing and leading whitespace)
icon?stringicon hash
icon_hash??stringicon hash, returned when in the template object
splash?stringsplash hash
discovery_splash?stringdiscovery hash; Only present for guilds with the "DISCOVERABLE" feature
owner? *booleantrue if the user is the owner of the guild
owner_idsnowflakeid of owner
permissions? *stringtotal permissions for the user in the guild (excludes overwrites and implicit permissions)
afk_channel_id?snowflakeid of afk channel
afk_timeoutintegerafk timeout in seconds
widget_enabled?booleantrue if the server widget is enabled
widget_channel_id??snowflakethe channel id that the widget will generate an invite to, or null if set to no invite
verification_levelintegerverification level required for the guild
default_message_notificationsintegerdefault message notifications level
explicit_content_filterintegerexplicit content filter level
rolesarray of role objectsroles in the guild
emojisarray of emoji objectscustom guild emojis
featuresarray of guild feature stringsenabled guild features
mfa_levelintegerrequired MFA level for the guild
application_id?snowflakeapplication id of the guild creator if it is bot-created
system_channel_id?snowflakethe id of the channel where guild notices such as welcome messages and boost events are posted
system_channel_flagsintegersystem channel flags
rules_channel_id?snowflakethe id of the channel where Community guilds can display rules and/or guidelines
max_presences??integerthe maximum number of presences for the guild (null is always returned, apart from the largest of guilds)
max_members?integerthe maximum number of members for the guild
vanity_url_code?stringthe vanity url code for the guild
description?stringthe description of a guild
banner?stringbanner hash
premium_tierintegerpremium tier (Server Boost level)
premium_subscription_count?integerthe number of boosts this guild currently has
preferred_localestringthe preferred locale of a Community guild; used in server discovery and notices from Discord, and sent in interactions; defaults to "en-US"
public_updates_channel_id?snowflakethe id of the channel where admins and moderators of Community guilds receive notices from Discord
max_video_channel_users?integerthe maximum amount of users in a video channel
max_stage_video_channel_users?integerthe maximum amount of users in a stage video channel
approximate_member_count?integerapproximate number of members in this guild
approximate_presence_count?integerapproximate number of non-offline members in this guild
welcome_screen?welcome screen objectthe welcome screen of a Community guild, shown to new members, returned in an Invite's guild object
nsfw_levelintegerguild NSFW level
stickers?array of sticker objectscustom guild stickers
premium_progress_bar_enabledbooleanwhether the guild has the boost progress bar enabled
safety_alerts_channel_id?snowflakethe id of the channel where admins and moderators of Community guilds receive safety alerts from Discord

* These fields are only sent when using the GET Current User Guilds endpoint and are relative to the requested user

Default Message Notification Level
KeyValueDescription
All Messages0members will receive notifications for all messages by default
Only Mentions1members will receive notifications only for messages that @mention them by default
Explicit Content Filter Level
LevelIntegerDescription
Disabled0media content will not be scanned
Members Without Roles1media content sent by members without roles will be scanned
All Members2media content sent by all members will be scanned
MFA Level
LevelIntegerDescription
None0guild has no MFA/2FA requirement for moderation actions
Elevated1guild has a 2FA requirement for moderation actions
Verification Level
LevelIntegerDescription
None0unrestricted
Low1must have verified email on account
Medium2must be registered on Discord for longer than 5 minutes
High3must be a member of the server for longer than 10 minutes
Very High4must have a verified phone number
Guild NSFW Level
LevelValue
Default0
Explicit1
Safe2
Age Restricted3
Premium Tier
LevelIntegerDescription
None0guild has not unlocked any Server Boost perks
Tier 11guild has unlocked Server Boost level 1 perks
Tier 22guild has unlocked Server Boost level 2 perks
Tier 33guild has unlocked Server Boost level 3 perks
System Channel Flags
FlagValueDescription
Suppress Join Notifications1 << 0Suppress member join notifications
Suppress Premium Subscriptions1 << 1Suppress server boost notifications
Suppress Guild Reminder Notifications1 << 2Suppress server setup tips
Suppress Join Notification Replies1 << 3Hide member join sticker reply buttons
Suppress Role Subscription Purchase Notifications1 << 4Suppress role subscription purchase and renewal notifications
Suppress Role Subscription Purchase Notification Replies1 << 5Hide role subscription sticker reply buttons
Guild Features
Feature -Description
Animated Bannerguild has access to set an animated guild banner image
Animated Iconguild has access to set an animated guild icon
Application Command Permissions V2guild is using the old permissions configuration behavior
Auto Moderationguild has set up auto moderation rules
Bannerguild has access to set a guild banner image
Communityguild can enable welcome screen, screening, stage channels, discovery, and receive community updates
Creator Monetizable Provisionalguild has enabled monetization
Creator Store Pageguild has enabled the role subscription promo page
Developer Support Serverguild has been set as a support server on the App Directory
Discoverableguild is able to be discovered in the directory
Featurableguild is able to be featured in the directory
Invites Disabledguild has paused invites, preventing new users from joining
Invite Splashguild has access to set an invite splash background
Member Verification Gate Enabledguild has enabled Membership Screening
More Stickersguild has increased custom sticker slots
Newsguild has access to create announcement channels
Partneredguild is partnered
Preview Enabledguild can be previewed before joining via Membership Screening or the directory
Raid Alerts Disabledguild has disabled alerts for join raids in the configured safety alerts channel
Role Iconsguild is able to set role icons
Role Subscriptions Available For Purchaseguild has role subscriptions that can be purchased
Role Subscriptions Enabledguild has enabled role subscriptions
Ticketed Events Enabledguild has enabled ticketed events
Vanity Urlguild has access to set a vanity URL
Verifiedguild is verified
Vip Regionsguild has access to set 384kbps bitrate in voice (previously VIP voice servers)
Welcome Screen Enabledguild has enabled the welcome screen
Mutable Guild Features
FeaturesRequired PermissionsEffects
CommunityAdministratorEnables Community Features in the guild
DiscoverableAdministrator*Enables discovery in the guild, making it publicly listed
Invites DisabledManage GuildPauses all invites/access to the server
Raid Alerts DisabledManage GuildDisables alerts for join raids
Guild Preview Structure
FieldTypeDescription
idsnowflakeguild id
namestringguild name (2-100 characters)
icon?stringicon hash
splash?stringsplash hash
discovery_splash?stringdiscovery splash hash
emojisarray of emoji objectscustom guild emojis
featuresarray of guild feature stringsenabled guild features
approximate_member_countnumberapproximate number of members in this guild
approximate_presence_countnumberapproximate number of online members in this guild
description?stringthe description for the guild
stickersarray of sticker objectscustom guild stickers
Guild Widget Settings Structure
FieldTypeDescription
enabledbooleanwhether the widget is enabled
channel_id?snowflakethe widget channel id
Guild Widget Structure
FieldTypeDescription
idsnowflakeguild id
namestringguild name (2-100 characters)
instant_invite?stringinstant invite for the guilds specified widget invite channel
channelsarray of partial channel objectsvoice and stage channels which are accessible by @everyone
membersarray of partial user objectsspecial widget user objects that includes users presence (Limit 100)
presence_countnumbernumber of online members in this guild
Guild Member Object
FieldTypeDescription
user?user objectthe user this guild member represents
nick??stringthis user's guild nickname
avatar??stringthe member's guild avatar hash
rolesarray of snowflakesarray of role object ids
joined_atISO8601 timestampwhen the user joined the guild
premium_since??ISO8601 timestampwhen the user started boosting the guild
deafbooleanwhether the user is deafened in voice channels
mutebooleanwhether the user is muted in voice channels
flagsnumberguild member flags represented as a bit set, defaults to 0
pending?booleanwhether the user has passed the guild's Membership Screening requirements
permissions?stringtotal permissions of the member in the channel, including overwrites, returned when in the interaction object
communication_disabled_until??ISO8601 timestampwhen the user's timeout will expire and the user will be able to communicate in the guild again

• The field user won't be included in the member object attached to MESSAGE_CREATE and MESSAGE_UPDATE gateway events. • In GUILD_ events, pending will always be included as true or false. In non GUILD_ events which can only be triggered by non-pending users, pending will not be included.

Guild Member Flags
FlagValueDescriptionEditable
Did Rejoin1 << 0Member has left and rejoined the guildfalse
Completed Onboarding1 << 1Member has completed onboardingfalse
Bypasses Verification1 << 2Member is exempt from guild verification requirementstrue
Started Onboarding1 << 3Member has started onboardingfalse

• BYPASSES_VERIFICATION allows a member who does not meet verification requirements to participate in a server.

Guild Scheduled Event Object
FieldTypeDescription
idsnowflakeThe ID of the scheduled event
guild_idsnowflakeThe guild ID to which the scheduled event belongs
channel_id?snowflakeThe channel ID where the scheduled event will be hosted, or null if the scheduled entity type is EXTERNAL
creator_id? *?snowflakeThe ID of the user who created the scheduled event
namestringThe name of the scheduled event (1-100 characters)
description??stringThe description of the scheduled event (1-1000 characters)
scheduled_start_timeISO8601 timestampThe time the scheduled event will start
scheduled_end_time?ISO8601 timestampThe time the scheduled event will end, required if the entity type is EXTERNAL
privacy_levelprivacy levelThe privacy level of the scheduled event
statusevent statusThe status of the scheduled event
entity_typescheduled entity typeThe type of the scheduled event
entity_id?snowflakeThe ID of an entity associated with a guild scheduled event
entity_metadata?entity metadataAdditional metadata for the guild scheduled event
creator?user objectThe user who created the scheduled event
user_count?numberThe number of users subscribed to the scheduled event
image??stringThe cover image hash of the scheduled event

* creator_id will be null and creator will not be included for events created before October 25th, 2021, when the concept of creator_id was introduced and tracked.

Guild Scheduled Event Privacy Level
LevelValueDescription
Guild Only2the scheduled event is only accessible to guild members
Guild Scheduled Event Entity Types
TypeValue
Stage Instance1
Voice2
External3
Field Requirements By Entity Type

• The following table shows field requirements based on current entity type. value : This field is required to be a non-null value null : This field is required to be null - : No strict requirements

Entity Typechannel_identity_metadatascheduled_end_time
Stage Instancevaluenull-
Voicevaluenull-
Externalnullvalue *value

* entity_metadata with a non-null location must be provided

Guild Scheduled Event Status
TypeValue
Scheduled1
Active2
Completed*3
Canceled*4

* Once status is set to COMPLETED or CANCELED, the status can no longer be updated

Valid Guild Scheduled Event Status Transitions

SCHEDULED --> ACTIVE ACTIVE --------> COMPLETED SCHEDULED --> CANCELED

Guild Scheduled Event Entity Metadata
FieldTypeDescription
location?*stringlocation of the event (1-100 characters)

* required for events with 'entity_type': EXTERNAL

Guild Scheduled Event User Object
FieldTypeDescription
guild_scheduled_event_idsnowflakethe scheduled event id which the user subscribed to
useruseruser which subscribed to an event
member?guild memberguild member data for this user for the guild which this event belongs to, if any
Guild Template Object
FieldTypeDescription
codestringthe template code (unique ID)
namestringtemplate name
description?stringthe description for the template
usage_countnumbernumber of times this template has been used
creator_idsnowflakethe ID of the user who created the template
creatoruser objectthe user who created the template
created_atISO8601 timestampwhen this template was created
updated_atISO8601 timestampwhen this template was last synced to the source guild
source_guild_idsnowflakethe ID of the guild this template is based on
serialized_source_guildpartial guild objectthe guild snapshot this template contains
is_dirty?booleanwhether the template has unsynced changes
Example Guild Template Object
{
  "code": "hgM48av5Q69A",
  "name": "Friends & Family",
  "description": "",
  "usage_count": 49605,
  "creator_id": "132837293881950208",
  "creator": {
    "id": "132837293881950208",
    "username": "hoges",
    "avatar": "79b0d9f8c340f2d43e1f78b09f175b62",
    "discriminator": "0001",
    "public_flags": 129
  },
  "created_at": "2020-04-02T21:10:38+00:00",
  "updated_at": "2020-05-01T17:57:38+00:00",
  "source_guild_id": "678070694164299796",
  "serialized_source_guild": {
    "name": "Friends & Family",
    "description": null,
    "region": "us-west",
    "verification_level": 0,
    "default_message_notifications": 0,
    "explicit_content_filter": 0,
    "preferred_locale": "en-US",
    "afk_timeout": 300,
    "roles": [
      {
        "id": 0,
        "name": "@everyone",
        "permissions": 104324689,
        "color": 0,
        "hoist": false,
        "mentionable": false
      }
    ],
    "channels": [
      {
        "name": "Text Channels",
        "position": 1,
        "topic": null,
        "bitrate": 64000,
        "user_limit": 0,
        "nsfw": false,
        "rate_limit_per_user": 0,
        "parent_id": null,
        "permission_overwrites": [],
        "id": 1,
        "type": 4
      },
      {
        "name": "general",
        "position": 1,
        "topic": null,
        "bitrate": 64000,
        "user_limit": 0,
        "nsfw": false,
        "rate_limit_per_user": 0,
        "parent_id": 1,
        "permission_overwrites": [],
        "id": 2,
        "type": 0
      }
    ],
    "afk_channel_id": null,
    "system_channel_id": 2,
    "system_channel_flags": 0,
    "icon_hash": null
  },
  "is_dirty": null
}
Integration Object
FieldTypeDescription
idsnowflakeintegration id
namestringintegration name
typestringintegration type (twitch, youtube, discord, or guild_subscription)
enabledbooleanis this integration enabled
syncing?booleanis this integration syncing
role_id?snowflakeid that this integration uses for "subscribers"
enable_emoticons?booleanwhether emoticons should be synced for this integration (twitch only)
expire_behavior?integration expire behaviorthe behavior of expiring subscribers
expire_grace_period?numberthe grace period (in days) before expiring subscribers
user?user objectuser for this integration
accountaccount objectintegration account information
synced_at?ISO8601 timestampwhen this integration was last synced
subscriber_count?numberhow many subscribers this integration has
revoked?booleanhas this integration been revoked
application?application objectThe bot/OAuth2 application for discord integrations
scopes?array of OAuth2 scopesthe scopes the application has been authorized for
Integration Expire Behaviors
ValueName
0Remove role
1Kick
Integration Account Object
FieldTypeDescription
idstringid of the account
namestringname of the account
Integration Application Object
FieldTypeDescription
idsnowflakethe id of the app
namestringthe name of the app
icon?stringthe icon hash of the app
descriptionstringthe description of the app
bot?user objectthe bot associated with this application
Ban Object
FieldTypeDescription
reason?stringthe reason for the ban
useruser objectthe banned user
Example Ban
{
  "reason": "mentioning lostmyinfo",
  "user": {
    "username": "goodsie",
    "id": "53908099506183680",
    "avatar": "a_bab14f271d565501444b2ca3be944b25",
    "public_flags": 131141
  }
}
Welcome Screen Object
FieldTypeDescription
description?stringthe server description shown in the welcome screen
welcome_channelsarray of welcome screen channel objectsthe channels shown in the welcome screen, up to 5
Welcome Screen Channel Object
FieldTypeDescription
channel_idsnowflakethe channel's id
descriptionstringthe description shown for the channel
emoji_id?snowflakethe emoji id, if the emoji is custom
emoji_name?stringthe emoji name if custom, the unicode character if standard, or null if no emoji is set
Guild Onboarding Object
FieldTypeDescription
guild_idsnowflakeID of the guild this onboarding is part of
promptsarray of onboarding prompt objectsPrompts shown during onboarding and in customize community
default_channel_idsarray of snowflakesChannel IDs that members get opted into automatically
enabledbooleanWhether onboarding is enabled in the guild
modeonboarding modeCurrent mode of onboarding
Onboarding Prompt Structure
FieldTypeDescription
idsnowflakeID of the prompt
typeprompt typeType of prompt
optionsarray of prompt option objectsOptions available within the prompt
titlestringTitle of the prompt
single_selectbooleanIndicates whether users are limited to selecting one option for the prompt
requiredbooleanIndicates whether the prompt is required before a user completes onboarding flow
in_onboardingbooleanIndicates whether the prompt is present in the onboarding flow. If false, the prompt will only appear in the Channels & Roles tab
Prompt Option Structure
FieldTypeDescription
idsnowflakeID of the prompt option
channel_idsarray of snowflakesIDs for channels a member is added to when the option is selected
role_idsarray of snowflakesIDs for roles assigned to a member when the option is selected
emoji?emoji objectEmoji of the option (see below)
emoji_id?snowflakeEmoji ID of the option (see below)
emoji_name?stringEmoji name of the option (see below)
emoji_animated?booleanWhether the emoji is animated (see below)
titlestringTitle of the option
description?stringDescription of the option

• When creating or updating a prompt option, the emoji_id, emoji_name, and emoji_animated fields must be used instead of the emoji object.

Onboarding Mode

• Defines the criteria used to satisfy Onboarding constraints that are required for enabling.

NameValueDescription
Onboarding Default0Counts only Default Channels towards constraints
Onboarding Advanced1Counts Default Channels and Questions towards constraints
Prompt Types
NameValue
Multiple Choice0
Dropdown1
Example Guild Onboarding
{
    "guild_id": "960007075288915998",
    "prompts": [
        {
            "id": "1067461047608422473",
            "title": "What do you want to do in this community?",
            "options": [
                {
                    "id": "1067461047608422476",
                    "title": "Chat with Friends",
                    "description": "",
                    "emoji": {
                        "id": "1070002302032826408",
                        "name": "chat",
                        "animated": false
                    },
                    "role_ids": [],
                    "channel_ids": [
                        "962007075288916001"
                    ]
                },
                {
                    "id": "1070004843541954678",
                    "title": "Get Gud",
                    "description": "We have excellent teachers!",
                    "emoji": {
                        "id": null,
                        "name": "😀",
                        "animated": false
                    },
                    "role_ids": [
                        "982014491980083211"
                    ],
                    "channel_ids": []
                }
            ],
            "single_select": false,
            "required": false,
            "in_onboarding": true,
            "type": 0
        }
    ],
    "default_channel_ids": [
        "998678771706110023",
        "998678693058719784",
        "1070008122577518632",
        "998678764340912138",
        "998678704446263309",
        "998678683592171602",
        "998678699715067986"
    ],
    "enabled": true
}

User

User Object
FieldTypeDescription
idsnowflakethe user's id
usernamestringthe user's username, not unique across the platform
discriminatorstringthe user's Discord-tag
global_name?stringthe user's display name, if it is set. For bots, this is the application name
avatar?stringthe user's avatar hash
bot?booleanwhether the user belongs to an OAuth2 application
system?booleanwhether the user is an Official Discord System user (part of the urgent message system)
mfa_enabled?booleanwhether the user has two factor enabled on their account
banner??stringthe user's banner hash
accent_color??integerthe user's banner color encoded as an integer representation of hexadecimal color code
locale?stringthe user's chosen language option
verified?booleanwhether the email on this account has been verified
email??stringthe user's email
flags?integerthe flags on a user's account
premium_type?integerthe type of Nitro subscription on a user's account
public_flags?integerthe public flags on a user's account
avatar_decoration??stringthe user's avatar decoration hash
User Flags
ValueNameDescription
1 << 0StaffDiscord Employee
1 << 1PartnerPartnered Server Owner
1 << 2HypesquadHypeSquad Events Member
1 << 3Bug Hunter Level 1Bug Hunter Level 1
1 << 6Hypesquad Online House 1House Bravery Member
1 << 7Hypesquad Online House 2House Brilliance Member
1 << 8Hypesquad Online House 3House Balance Member
1 << 9Premium Early SupporterEarly Nitro Supporter
1 << 10Team Pseudo UserUser is a team
1 << 14Bug Hunter Level 2Bug Hunter Level 2
1 << 16Verified BotVerified Bot
1 << 17Verified DeveloperEarly Verified Bot Developer
1 << 18Certified ModeratorModerator Programs Alumni
1 << 19Bot Http InteractionsBot uses only HTTP interactions and is shown in the online member list
1 << 22Active DeveloperUser is an Active Developer
Premium Types

• Premium types denote the level of premium a user has.

ValueName
0None
1Nitro Classic
2Nitro
3Nitro Basic
Connection Object

• The connection object that the user has attached.

FieldTypeDescription
idstringid of the connection account
namestringthe username of the connection account
typestringthe service of this connection
revoked?booleanwhether the connection is revoked
integrations?arrayan array of partial server integrations
verifiedbooleanwhether the connection is verified
friend_syncbooleanwhether friend sync is enabled for this connection
show_activitybooleanwhether activities related to this connection will be shown in presence updates
two_way_linkbooleanwhether this connection has a corresponding third party OAuth2 token
visibilityintegervisibility of this connection
Services
ValueName
battlenetBattle.net
ebayeBay
epicgamesEpic Games
facebookFacebook
githubGitHub
instagramInstagram
leagueoflegendsLeague of Legends
paypalPayPal
playstationPlayStation Network
redditReddit
riotgamesRiot Games
spotifySpotify
skype *Skype
steamSteam
tiktokTikTok
twitchTwitch
twitterX (Twitter)
xboxXbox
youtubeYouTube
* Service can no longer be added by users
Visibility Types
ValueNameDescription
0Noneinvisible to everyone except the user themselves
1Everyonevisible to everyone
Application Role Connection Object

The role connection object that an application has attached to a user.

FieldTypeDescription
platform_name?stringthe vanity name of the platform a bot has connected (max 50 characters)
platform_username?stringthe username on the platform a bot has connected (max 100 characters)
metadataobjectobject mapping application role connection metadata keys to their string-ified value (max 100 characters) for the user on the platform a bot has connected
Application Role Connection Metadata Object
FieldTypeDescription
typeApplicationRoleConnectionMetadataTypetype of metadata value
keystringdictionary key for the metadata field (must be a-z, 0-9, or _ characters; 1-50 characters)
namestringname of the metadata field (1-100 characters)
name_localizations?dictionary with keys in available localestranslations of the name
descriptionstringdescription of the metadata field (1-200 characters)
description_localizations?dictionary with keys in available localestranslations of the description
Application Role Connection Metadata Type
TypeValueDescription
INTEGER_LESS_THAN_OR_EQUAL1the metadata value (integer) is less than or equal to the guild's configured value (integer)
INTEGER_GREATER_THAN_OR_EQUAL2the metadata value (integer) is greater than or equal to the guild's configured value (integer)
INTEGER_EQUAL3the metadata value (integer) is equal to the guild's configured value (integer)
INTEGER_NOT_EQUAL4the metadata value (integer) is not equal to the guild's configured value (integer)
DATETIME_LESS_THAN_OR_EQUAL5the metadata value (ISO8601 string) is less than or equal to the guild's configured value (integer; days before current date)
DATETIME_GREATER_THAN_OR_EQUAL6the metadata value (ISO8601 string) is greater than or equal to the guild's configured value (integer; days before current date)
BOOLEAN_EQUAL7the metadata value (integer) is equal to the guild's configured value (integer; 1)
BOOLEAN_NOT_EQUAL8the metadata value (integer) is not equal to the guild's configured value (integer; 1)

Emoji/Sticker

Emoji Object
FieldTypeDescription
id?snowflakeemoji id
name?string (can be null only in reaction emoji objects)emoji name
roles?array of role object idsroles allowed to use this emoji
user?user objectuser that created this emoji
require_colons?booleanwhether this emoji must be wrapped in colons
managed?booleanwhether this emoji is managed
animated?booleanwhether this emoji is animated
available?booleanwhether this emoji can be used, may be false due to loss of Server Boosts
Emoji Example
{
  "id": "41771983429993937",
  "name": "LUL",
  "roles": ["41771983429993000", "41771983429993111"],
  "user": {
    "username": "Luigi",
    "discriminator": "0002",
    "id": "96008815106887111",
    "avatar": "5500909a3274e1812beb4e8de6631111",
    "public_flags": 131328
  },
  "require_colons": true,
  "managed": false,
  "animated": false
}
Standard Emoji Example
{
  "id": null,
  "name": "�"
}
Custom Emoji Examples
{
  "id": "41771983429993937",
  "name": "LUL",
  "animated": true
}
{
  "id": "41771983429993937",
  "name": null
}
Sticker Object
FieldTypeDescription
idsnowflakeid of the sticker
pack_id?snowflakefor standard stickers, id of the pack the sticker is from
namestringname of the sticker
description?stringdescription of the sticker
tagsstringautocomplete/suggestion tags for the sticker (max 200 characters)
typenumbertype of sticker
format_typenumbertype of sticker format
available?booleanwhether this guild sticker can be used, may be false due to loss of Server Boosts
guild_id?snowflakeid of the guild that owns this sticker
user?user objectthe user that uploaded the guild sticker
sort_value?numberthe standard sticker's sort order within its pack
Sticker Types
TypeValueDescription
Standard1an official sticker in a pack
Guild2a sticker uploaded to a guild for the guild's members
Sticker Format Types
TypeValue
PNG1
APNG2
LOTTIE3
GIF4
Example Sticker
{
  "id": "749054660769218631",
  "name": "Wave",
  "tags": "wumpus, hello, sup, hi, oi, heyo, heya, yo, greetings, greet, welcome, wave, :wave, :hello, :hi, :hey, hey, \ud83d\udc4b, \ud83d\udc4b\ud83c\udffb, \ud83d\udc4b\ud83c\udffc, \ud83d\udc4b\ud83c\udffd, \ud83d\udc4b\ud83c\udffe, \ud83d\udc4b\ud83c\udfff, goodbye, bye, see ya, later, laterz, cya",
  "type": 1,
  "format_type": 3,
  "description": "Wumpus waves hello",
  "asset": "",
  "pack_id": "847199849233514549",
  "sort_value": 12
}
Sticker Item Object
FieldTypeDescription
idsnowflakeid of the sticker
namestringname of the sticker
format_typenumbertype of sticker format
Sticker Pack Object
FieldTypeDescription
idsnowflakeid of the sticker pack
stickersarray of sticker objectsthe stickers in the pack
namestringname of the sticker pack
sku_idsnowflakeid of the pack's SKU
cover_sticker_id?snowflakeid of a sticker in the pack which is shown as the pack's icon
descriptionstringdescription of the sticker pack
banner_asset_id?snowflakeid of the sticker pack's banner image
Example Sticker Pack
{
  "id": "847199849233514549",
  "stickers": [],
  "name": "Wumpus Beyond",
  "sku_id": "847199849233514547",
  "cover_sticker_id": "749053689419006003",
  "description": "Say hello to Wumpus!",
  "banner_asset_id": "761773777976819732"
}

Role

Role Object

• Roles represent a set of permissions attached to a group of users. • Roles have names, colors, and can be "pinned" to the side bar, causing their members to be listed separately. Roles can have separate permission profiles for the global context (guild) and channel context.

The @everyone role has the same ID as the guild it belongs to.

FieldTypeDescription
idsnowflakerole id
namestringrole name
colorintegerinteger representation of hexadecimal color code
hoistbooleanif this role is pinned in the user listing
icon??stringrole icon hash
unicode_emoji??stringrole unicode emoji
positionintegerposition of this role
permissionsstringpermission bit set
managedbooleanwhether this role is managed by an integration
mentionablebooleanwhether this role is mentionable
tags?role tags objectthe tags this role has
flagsintegerrole flags combined as a bitfield
Role Tags Structure

• Tags with type null represent booleans. • They will be present and set to null if they are "true", and will be not present if they are "false".

FieldTypeDescription
bot_id?snowflakethe id of the bot this role belongs to
integration_id?snowflakethe id of the integration this role belongs to
premium_subscriber?nullwhether this is the guild's Booster role
subscription_listing_id?snowflakethe id of this role's subscription sku and listing
available_for_purchase?nullwhether this role is available for purchase
guild_connections?nullwhether this role is a guild's linked role
Role Flags
FlagValueDescription
IN_PROMPT1 << 0role can be selected by members in an onboarding prompt

Channel

Channel Object
FieldTypeDescription
idsnowflakethe id of this channel
typeintegerthe type of channel
guild_id?snowflakethe id of the guild (may be missing for some channel objects received over gateway guild dispatches)
position?integersorting position of the channel
permission_overwrites?array of overwrite objectsexplicit permission overwrites for members and roles
name??stringthe name of the channel (1-100 characters)
topic??stringthe channel topic (0-4096 characters for GUILD_FORUM and GUILD_MEDIA channels, 0-1024 characters for all others)
nsfw?booleanwhether the channel is nsfw
last_message_id??snowflakethe id of the last message sent in this channel (or thread for GUILD_FORUM or GUILD_MEDIA channels) (may not point to an existing or valid message or thread)
bitrate?integerthe bitrate (in bits) of the voice channel
user_limit?integerthe user limit of the voice channel
rate_limit_per_user?*integeramount of seconds a user has to wait before sending another message (0-21600); bots, as well as users with the permission manage_messages or manage_channel, are unaffected
recipients?array of user objectsthe recipients of the DM
icon??stringicon hash of the group DM
owner_id?snowflakeid of the creator of the group DM or thread
application_id?snowflakeapplication id of the group DM creator if it is bot-created
managed?booleanfor group DM channels: whether the channel is managed by an application via the gdm.join OAuth2 scope
parent_id??snowflakefor guild channels: id of the parent category for a channel (each parent category can contain up to 50 channels), for threads: id of the text channel this thread was created
last_pin_timestamp??ISO8601 timestampwhen the last pinned message was pinned. This may be null in events such as GUILD_CREATE when a message is not pinned.
rtc_region??stringvoice region id for the voice channel, automatic when set to null
video_quality_mode?integerthe camera video quality mode of the voice channel, 1 when not present
message_count?**integernumber of messages (not including the initial message or deleted messages) in a thread.
member_count?integeran approximate count of users in a thread, stops counting at 50
thread_metadata?thread metadata objectthread-specific fields not needed by other channels
member?thread member objectthread member object for the current user, if they have joined the thread, only included on certain API endpoints
default_auto_archive_duration?integerdefault duration, copied onto newly created threads, in minutes, threads will stop showing in the channel list after the specified period of inactivity, can be set to: 60, 1440, 4320, 10080
permissions?stringcomputed permissions for the invoking user in the channel, including overwrites, only included when part of the resolved data received on a slash command interaction.
flags?integerchannel flags combined as bitfield
total_message_sent?integernumber of messages ever sent in a thread, it's similar to message_count on message creation, but will not decrement the number when a message is deleted
available_tags?array of tag objectsthe set of tags that can be used in a GUILD_FORUM or a GUILD_MEDIA channel
applied_tags?array of snowflakesthe IDs of the set of tags that have been applied to a thread in a GUILD_FORUM or a GUILD_MEDIA channel
default_reaction_emoji??default reaction objectthe emoji to show in the add reaction button on a thread in a GUILD_FORUM or a GUILD_MEDIA channel
default_thread_rate_limit_per_user?integerthe initial rate_limit_per_user to set on newly created threads in a channel. this field is copied to the thread at creation time and does not live update.
default_sort_order??integerthe default sort order type used to order posts in GUILD_FORUM and GUILD_MEDIA channels. Defaults to null, which indicates a preferred sort order hasn't been set by a channel admin
default_forum_layout?integerthe default forum layout view used to display posts in GUILD_FORUM channels. Defaults to 0, which indicates a layout view has not been set by a channel admin

* rate_limit_per_user also applies to thread creation. Users can send one message and create one thread during each rate_limit_per_user interval. ** For threads created before July 1, 2022, the message count is inaccurate when it's greater than 50.

Channel Types
TypeIDDescription
Guild Text0a text channel within a server
Dm1a direct message between users
Guild Voice2a voice channel within a server
Group Dm3a direct message between multiple users
Guild Category4an organizational category that contains up to 50 channels
Guild Announcement5a channel that users can follow and crosspost into their own server (formerly news channels)
Announcement Thread10a temporary sub-channel within a GUILD_ANNOUNCEMENT channel
Public Thread11a temporary sub-channel within a GUILD_TEXT or GUILD_FORUM channel
Private Thread12a temporary sub-channel within a GUILD_TEXT channel that is only viewable by those invited and those with the MANAGE_THREADS permission
Guild Stage Voice13a voice channel for hosting events with an audience
Guild Directory14the channel in a hub containing the listed servers
Guild Forum15Channel that can only contain threads
Guild Media16Channel that can only contain threads, similar to GUILD_FORUM channels

* The GUILD_MEDIA channel type is still in active development. Avoid implementing any features that are not documented here, since they are subject to change without notice!

Partial Channel Object
FieldTypeDescription
idsnowflakeid of the channel
typeintegerthe type of channel
namestringthe name of the channel
permissionsstringpermission bit set
Video Quality Modes
ModeValueDescription
Auto1Discord chooses the quality for optimal performance
Full2720p
Channel Flags
FlagValueDescription
Pinned1 << 1this thread is pinned to the top of its parent GUILD_FORUM or GUILD_MEDIA channel
Require Tag1 << 4whether a tag is required to be specified when creating a thread in a GUILD_FORUM or a GUILD_MEDIA channel. Tags are specified in the applied_tags field.
Hide Media Download Options1 << 15when set hides the embedded media download options. Available only for media channels
Sort Order Types
FlagValueDescription
Latest Activity0Sort forum posts by activity
Creation Date1Sort forum posts by creation time (from most recent to oldest)
Forum Layout Types
FlagValueDescription
Not Set0No default has been set for forum channel
List View1Display posts as a list
Gallery View2Display posts as a collection of tiles
Example Guild Announcement Channel
{
  "id": "41771983423143937",
  "guild_id": "41771983423143937",
  "name": "important-news",
  "type": 5,
  "position": 6,
  "permission_overwrites": [],
  "nsfw": true,
  "topic": "Rumors about Half Life 3",
  "last_message_id": "155117677105512449",
  "parent_id": "399942396007890945",
  "default_auto_archive_duration": 60
}
Example Guild Voice Channel
{
  "id": "155101607195836416",
  "last_message_id": "174629835082649376",
  "type": 2,
  "name": "ROCKET CHEESE",
  "position": 5,
  "parent_id": null,
  "bitrate": 64000,
  "user_limit": 0,
  "rtc_region": null,
  "guild_id": "41771983423143937",
  "permission_overwrites": [],
  "rate_limit_per_user": 0,
  "nsfw": false,
}
Example DM Channel
{
  "last_message_id": "3343820033257021450",
  "type": 1,
  "id": "319674150115610528",
  "recipients": [
    {
      "username": "test",
      "discriminator": "9999",
      "id": "82198898841029460",
      "avatar": "33ecab261d4681afa4d85a04691c4a01"
    }
  ]
}
Example Group DM Channel
{
  "name": "Some test channel",
  "icon": null,
  "recipients": [
    {
      "username": "test",
      "discriminator": "9999",
      "id": "82198898841029460",
      "avatar": "33ecab261d4681afa4d85a04691c4a01"
    },
    {
      "username": "test2",
      "discriminator": "9999",
      "id": "82198810841029460",
      "avatar": "33ecab261d4681afa4d85a10691c4a01"
    }
  ],
  "last_message_id": "3343820033257021450",
  "type": 3,
  "id": "319674150115710528",
  "owner_id": "82198810841029460"
}
Example Channel Category
{
  "permission_overwrites": [],
  "name": "Test",
  "parent_id": null,
  "nsfw": false,
  "position": 0,
  "guild_id": "290926798629997250",
  "type": 4,
  "id": "399942396007890945"
}
Example Thread Channel
{
  "id": "41771983423143937",
  "guild_id": "41771983423143937",
  "parent_id": "41771983423143937",
  "owner_id": "41771983423143937",
  "name": "don't buy dota-2",
  "type": 11,
  "last_message_id": "155117677105512449",
  "message_count": 1,
  "member_count": 5,
  "rate_limit_per_user": 2,
  "thread_metadata": {
    "archived": false,
    "auto_archive_duration": 1440,
    "archive_timestamp": "2021-04-12T23:40:39.855793+00:00",
    "locked": false
  },
  "total_message_sent": 1
}
Message Object
FieldTypeDescription
idsnowflakeid of the message
channel_idsnowflakeid of the channel the message was sent in
author*user objectthe author of this message
content**stringcontents of the message
timestampISO8601 timestampwhen this message was sent
edited_timestamp?ISO8601 timestampwhen this message was edited (or null if never)
ttsbooleanwhether this was a TTS message
mention_everyonebooleanwhether this message mentions everyone
mentionsarray of user objectsusers specifically mentioned in the message
mention_rolesarray of role object idsroles specifically mentioned in this message
mention_channels?***array of channel mention objectschannels specifically mentioned in this message
attachments**array of attachment objectsany attached files
embeds**array of embed objectsany embedded content
reactions?array of reaction objectsreactions to the message
nonce?integer or stringused for validating a message was sent
pinnedbooleanwhether this message is pinned
webhook_id?snowflakeif the message is generated by a webhook, this is the webhook's id
typeintegertype of message
activity?message activity objectsent with Rich Presence-related chat embeds
application?partial application objectsent with Rich Presence-related chat embeds
application_id?snowflakeif the message is an Interaction or application-owned webhook, this is the id of the application
message_reference?message reference objectdata showing the source of a crosspost, channel follow add, pin, or reply message
flags?integermessage flags combined as a bitfield
referenced_message?****?message objectthe message associated with the message_reference
interaction?message interaction objectsent if the message is a response to an Interaction
thread?channel objectthe thread that was started from this message, includes thread member object
components?**array of message componentssent if the message contains components like buttons, action rows, or other interactive components
sticker_items?array of message sticker item objectssent if the message contains stickers
position?integerA generally increasing integer (there may be gaps or duplicates) that represents the approximate position of the message in a thread, it can be used to estimate the relative position of the message in a thread in company with total_message_sent on parent thread
role_subscription_data?role subscription data objectdata of the role subscription purchase or renewal that prompted this ROLE_SUBSCRIPTION_PURCHASE message
resolved?resolved datadata for users, members, channels, and roles in the message's auto-populated select menus

* The author object follows the structure of the user object, but is only a valid user in the case where the message is generated by a user or bot user. If the message is generated by a webhook, the author object corresponds to the webhook's id, username, and avatar. You can tell if a message is generated by a webhook by checking for the webhook_id on the message object. ** An app will receive empty values in the content, embeds, attachments, and components fields if they have not configured (or been approved for) the MESSAGE_CONTENT privileged intent (1 << 15). *** Not all channel mentions in a message will appear in mention_channels. Only textual channels that are visible to everyone in a lurkable guild will ever be included. Only crossposted messages (via Channel Following) currently include mention_channels at all. If no mentions in the message meet these requirements, this field will not be sent. **** This field is only returned for messages with a type of 19 (REPLY) or 21 (THREAD_STARTER_MESSAGE). If the message is a reply but the referenced_message field is not present, the backend did not attempt to fetch the message that was being replied to, so its state is unknown. If the field exists but is null, the referenced message was deleted.

Forum and Media Thread Message Params Object
FieldTypeDescription
content?*stringMessage contents (up to 2000 characters)
embeds?*array of embed objectsUp to 10 rich embeds (up to 6000 characters)
allowed_mentions?allowed mention objectAllowed mentions for the message
components?*array of message component objectsComponents to include with the message
sticker_ids?*array of snowflakesIDs of up to 3 stickers in the server to send in the message
attachments?array of partial attachment objectsAttachment objects with filename and description
flags?integerMessage flags (only SUPPRESS_EMBEDS and SUPPRESS_NOTIFICATIONS can be set)

* At least one of content, embeds, sticker_ids, components, or files[n] is required.

Message Types
TypeValueDeletable
Default0true
Recipient Add1false
Recipient Remove2false
Call3false
Channel Name Change4false
Channel Icon Change5false
Channel Pinned Message6true
User Join7true
Guild Boost8true
Guild Boost Tier 19true
Guild Boost Tier 210true
Guild Boost Tier 311true
Channel Follow Add12true
Guild Discovery Disqualified14false
Guild Discovery Requalified15false
Guild Discovery Grace Period Initial Warning16false
Guild Discovery Grace Period Final Warning17false
Thread Created18true
Reply19true
Chat Input Command20true
Thread Starter Message21false
Guild Invite Reminder22true
Context Menu Command23true
Auto Moderation Action24true*
Role Subscription Purchase25true
Interaction Premium Upsell26true
Stage Start27true
Stage End28true
Stage Speaker29true
Stage Topic31true
Guild Application Premium Subscription32false

* Can only be deleted by members with MANAGE_MESSAGES permission

Message Activity Structure
FieldTypeDescription
typeintegertype of message activity
party_id?stringparty_id from a Rich Presence event
Message Activity Types
TypeValue
Join1
Spectate2
Listen3
Join Request5
Message Flags
FlagValueDescription
Crossposted1 << 0this message has been published to subscribed channels (via Channel Following)
Is Crosspost1 << 1this message originated from a message in another channel (via Channel Following)
Suppress Embeds1 << 2do not include any embeds when serializing this message
Source Message Deleted1 << 3the source message for this crosspost has been deleted (via Channel Following)
Urgent1 << 4this message came from the urgent message system
Has Thread1 << 5this message has an associated thread, with the same id as the message
Ephemeral1 << 6this message is only visible to the user who invoked the Interaction
Loading1 << 7this message is an Interaction Response and the bot is "thinking"
Failed To Mention Some Roles In Thread1 << 8this message failed to mention some roles and add their members to the thread
Suppress Notifications1 << 12this message will not trigger push and desktop notifications
Is Voice Message1 << 13this message is a voice message
Message Reference Object
FieldTypeDescription
message_id?snowflakeid of the originating message
channel_id? *snowflakeid of the originating message's channel
guild_id?snowflakeid of the originating message's guild
fail_if_not_exists?booleanwhen sending, whether to error if the referenced message doesn't exist instead of sending as a normal (non-reply) message, default true

* channel_id is optional when creating a reply, but will always be present when receiving an event/response that includes this data model.

Followed Channel Structure
FieldTypeDescription
channel_idsnowflakesource channel id
webhook_idsnowflakecreated target webhook id
Reaction Object
FieldTypeDescription
countintegerTotal number of times this emoji has been used to react (including super reacts)
count_detailsobjectReaction count details object
mebooleanWhether the current user reacted using this emoji
me_burstbooleanWhether the current user super-reacted using this emoji
emojipartial emoji objectemoji information
burst_colorsarrayHEX colors used for super reaction
Reaction Count Details Object
FieldTypeDescription
burstintegerCount of super reactions
normalintegerCount of normal reactions
Overwrite Object
FieldTypeDescription
idsnowflakerole or user id
typeinteither 0 (role) or 1 (member)
allowstringpermission bit set
denystringpermission bit set
Thread Metadata Object
FieldTypeDescription
archivedbooleanwhether the thread is archived
auto_archive_durationintegerthe thread will stop showing in the channel list after auto_archive_duration minutes of inactivity, can be set to: 60, 1440, 4320, 10080
archive_timestampISO8601 timestamptimestamp when the thread's archive status was last changed, used for calculating recent activity
lockedbooleanwhether the thread is locked; when a thread is locked, only users with MANAGE_THREADS can unarchive it
invitable?booleanwhether non-moderators can add other non-moderators to a thread; only available on private threads
create_timestamp??ISO8601 timestamptimestamp when the thread was created; only populated for threads created after 2022-01-09
Thread Member Object
FieldTypeDescription
id? *snowflakeID of the thread
user_id? *snowflakeID of the user
join_timestampISO8601 timestampTime the user last joined the thread
flagsintegerAny user-thread settings, currently only used for notifications
member? **guild member objectAdditional information about the user

* These fields are omitted on the member sent within each thread in the GUILD_CREATE event. ** The member field is only present when with_member is set to true when calling List Thread Members or Get Thread Member.

Default Reaction Object
FieldTypeDescription
emoji_id?snowflakethe id of a guild's custom emoji
emoji_name?stringthe unicode character of the emoji
Forum Tag Object
FieldTypeDescription
idsnowflakethe id of the tag
namestringthe name of the tag (0-20 characters)
moderatedbooleanwhether this tag can only be added to or removed from threads by a member with the MANAGE_THREADS permission
emoji_id?snowflakethe id of a guild's custom emoji *
emoji_name?stringthe unicode character of the emoji *

* At most one of emoji_id and emoji_name may be set to a non-null value.

Embed Object
FieldTypeDescription
title?stringtitle of embed
type?stringtype of embed (always "rich" for webhook embeds)
description?stringdescription of embed
url?stringurl of embed
timestamp?ISO8601 timestamptimestamp of embed content
color?numbercolor code of the embed
footer?embed footer objectfooter information
image?embed image objectimage information
thumbnail?embed thumbnail objectthumbnail information
video?embed video objectvideo information
provider?embed provider objectprovider information
author?embed author objectauthor information
fields?array of embed field objectsfields information
Embed Thumbnail Structure
FieldTypeDescription
urlstringsource url of thumbnail (only supports http(s) and attachments)
proxy_url?stringa proxied url of the thumbnail
height?integerheight of thumbnail
width?integerwidth of thumbnail
Embed Video Structure
FieldTypeDescription
url?stringsource url of video
proxy_url?stringa proxied url of the video
height?integerheight of video
width?integerwidth of video
Embed Image Structure
FieldTypeDescription
urlstringsource url of image (only supports http(s) and attachments)
proxy_url?stringa proxied url of the image
height?integerheight of image
width?integerwidth of image
Embed Provider Structure
FieldTypeDescription
name?stringname of provider
url?stringurl of provider
Embed Author Structure
FieldTypeDescription
namestringname of author
url?stringurl of author (only supports http(s))
icon_url?stringurl of author icon (only supports http(s) and attachments)
proxy_icon_url?stringa proxied url of author icon
FieldTypeDescription
textstringfooter text
icon_url?stringurl of footer icon (only supports http(s) and attachments)
proxy_icon_url?stringa proxied url of footer icon
Embed Field Structure
FieldTypeDescription
namestringname of the field
valuestringvalue of the field
inline?booleanwhether or not this field should display inline
Embed Limits
FieldLimit
title256 characters
description4096 characters
fieldsUp to 25 field objects
field.name256 characters
field.value1024 characters
footer.text2048 characters
author.name256 characters

• Additionally, the combined sum of characters in all title, description, field.name, field.value, footer.text, and author.name fields across all embeds attached to a message must not exceed 6000 characters. • Violating any of these constraints will result in a Bad Request response. • Embeds are deduplicated by URL. If a message contains multiple embeds with the same URL, only the first is shown.

Attachment Object
FieldTypeDescription
idsnowflakeattachment id
filenamestringname of file attached
description?stringdescription for the file (max 1024 characters)
content_type?stringthe attachment's media type
sizenumbersize of file in bytes
urlstringsource url of file
proxy_urlstringa proxied url of file
height??numberheight of file (if image)
width??numberwidth of file (if image)
ephemeral? *booleanwhether this attachment is ephemeral
duration_secs?floatthe duration of the audio file (currently for voice messages)
waveform?stringbase64 encoded bytearray representing a sampled waveform (currently for voice messages)
flags?numberattachment flags combined as a bitfield

* Ephemeral attachments will automatically be removed after a set period of time. Ephemeral attachments on messages are guaranteed to be available as long as the message itself exists.

Attachment Flags
FlagValueDescription
Is Remix1 << 2this attachment has been edited using the remix feature on mobile
Channel Mention Object
FieldTypeDescription
idsnowflakeid of the channel
guild_idsnowflakeid of the guild containing the channel
typeintegerthe type of channel
namestringthe name of the channel
Allowed Mentions Object
FieldTypeDescription
parsearray of allowed mention typesAn array of allowed mention types to parse from the content.
roleslist of snowflakesArray of role_ids to mention (Max size of 100)
userslist of snowflakesArray of user_ids to mention (Max size of 100)
replied_userbooleanFor replies, whether to mention the author of the message being replied to (default false)
Allowed Mention Types
TypeValueDescription
Role Mentions"roles"Controls role mentions
User Mentions"users"Controls user mentions
Everyone Mentions"everyone"Controls @everyone and @here mentions
Allowed Mentions Reference

• If allowed_mentions is not passed in (i.e. the key does not exist), the mentions will be parsed via the content. This corresponds with existing behavior.

In the example below we would ping @here (and also @role124 and @user123)

{
  "content": "@here Hi there from <@123>, cc <@&124>"
}

To suppress all mentions in a message use:

{
  "content": "@everyone hi there, <@&123>",
  "allowed_mentions": {
    "parse": []
  }
}

This will suppress all mentions in the message (no @everyone or user mention).

• The parse field is mutually exclusive with the other fields. In the example below, we would ping users 123 and role 124, but not @everyone.

Note that passing a Falsy value ([], null) into the "users" field does not trigger a validation error.

{
  "content": "@everyone <@123> <@&124>",
  "allowed_mentions": {
    "parse": ["users", "roles"],
    "users": []
  }
}

In the next example, we would ping @everyone, (and also users 123 and 124 if they suppressed @everyone mentions), but we would not ping any roles.

{
  "content": "@everyone <@123> <@124> <@125> <@&200>",
  "allowed_mentions": {
    "parse": ["everyone"],
    "users": ["123", "124"]
  }
}

Message Components

Component Object
TypeNameDescription
1Action RowContainer for other components
2ButtonButton object
3String SelectSelect menu for picking from defined text options
4Text InputText input object
5User SelectSelect menu for users
6Role SelectSelect menu for roles
7Mentionable SelectSelect menu for mentionables (users and roles)
8Channel SelectSelect menu for channels
Button Object
FieldTypeDescription
typeinteger2 for a button
styleintegerA button style
label?stringText that appears on the button; max 80 characters
emoji?partial emojiname, id, and animated
custom_id?stringDeveloper-defined identifier for the button; max 100 characters
url?stringURL for link-style buttons
disabled?booleanWhether the button is disabled (defaults to false)
Button Styles
NameValueColorRequired Field
Primary1blurplecustom_id
Secondary2greycustom_id
Success3greencustom_id
Danger4redcustom_id
Link5grey, navigates to a URLurl
Select Menu Object
FieldTypeDescription
typeintegerType of select menu component (text: 3, user: 5, role: 6, mentionable: 7, channels: 8)
custom_idstringID for the select menu; max 100 characters
options?*array of select optionsSpecified choices in a select menu (only required and available for string selects (type 3)); max 25
channel_types?**array of channel typesList of channel types to include in the channel select component (type 8)
placeholder?stringPlaceholder text if nothing is selected; max 150 characters
default_values?***array of default value objectsList of default values for auto-populated select menu components; number of default values must be in the range defined by min_values and max_values
min_values?integerMinimum number of items that must be chosen (defaults to 1); min 0, max 25
max_values?integerMaximum number of items that can be chosen (defaults to 1); max 25
disabled?booleanWhether select menu is disabled (defaults to false)

* options is required for string select menus (component type 3), and unavailable for all other select menu components. ** channel_types can only be used for channel select menu components. *** default_values is only available for auto-populated select menu components, which include user (5), role (6), mentionable (7), and channel (8) components.

Select Option Structure
FieldTypeDescription
labelstringUser-facing name of the option; max 100 characters
valuestringDev-defined value of the option; max 100 characters
description?stringAdditional description of the option; max 100 characters
emoji?partial emoji objectid, name, and animated
default?booleanWill show this option as selected by default
Select Default Value Structure
FieldTypeDescription
idsnowflakeID of a user, role, or channel
typestringType of value that id represents. Either "user", "role", or "channel"
Text Input Object
FieldTypeDescription
typeinteger4 for a text input
custom_idstringDeveloper-defined identifier for the input; max 100 characters
styleintegerThe Text Input Style
labelstringLabel for this component; max 45 characters
min_length?integerMinimum input length for a text input; min 0, max 4000
max_length?integerMaximum input length for a text input; min 1, max 4000
required?booleanWhether this component is required to be filled (defaults to true)
value?stringPre-filled value for this component; max 4000 characters
placeholder?stringCustom placeholder text if the input is empty; max 100 characters
Text Input Styles
NameValueDescription
Short1Single-line input
Paragraph2Multi-line input

Webhook

Webhook Object
FieldTypeDescription
idsnowflakethe id of the webhook
typeintegerthe type of the webhook
guild_id??snowflakethe guild id this webhook is for, if any
channel_id?snowflakethe channel id this webhook is for, if any
user?user objectthe user this webhook was created by (not returned when getting a webhook by token)
name?stringthe default name of the webhook
avatar?stringthe default user avatar hash of the webhook
token?stringthe secure token of the webhook (returned for Incoming Webhooks)
application_id?snowflakethe bot/OAuth2 application that created this webhook
source_guild? *partial guild objectthe guild of the channel that this webhook is following (returned for Channel Follower Webhooks)
source_channel? *partial channel objectthe channel that this webhook is following (returned for Channel Follower Webhooks)
url?stringthe url used for executing the webhook (returned by the webhooks OAuth2 flow)

* These fields will be absent if the webhook creator has since lost access to the guild where the followed channel resides

Webhook Types
ValueNameDescription
1IncomingIncoming Webhooks can post messages to channels with a generated token
2Channel FollowerChannel Follower Webhooks are internal webhooks used with Channel Following to post new messages into channels
3ApplicationApplication webhooks are webhooks used with Interactions

Interaction

Interaction Object
FieldTypeDescription
idsnowflakeID of the interaction
application_idsnowflakeID of the application this interaction is for
typeinteraction typeType of interaction
data?*interaction dataInteraction data payload
guild_id?snowflakeGuild that the interaction was sent from
channel?partial channel objectChannel that the interaction was sent from
channel_id?snowflakeChannel that the interaction was sent from
member?**guild member objectGuild member data for the invoking user, including permissions
user?user objectUser object for the invoking user, if invoked in a DM
tokenstringContinuation token for responding to the interaction
versionintegerRead-only property, always 1
message?message objectFor components, the message they were attached to
app_permissions?stringBitwise set of permissions the app or bot has within the channel the interaction was sent from
locale?***stringSelected language of the invoking user
guild_locale?stringGuild's preferred locale, if invoked in a guild
entitlementsarray of entitlement objectsFor monetized apps, any entitlements for the invoking user, representing access to premium SKUs

* This is always present on application command, message component, and modal submit interaction types. ** member is sent when the interaction is invoked in a guild, and user is sent when invoked in a DM *** This is available on all interaction types except PING

Interaction Type
NameValue
Ping1
Application Command2
Message Component3
Application Command Autocomplete4
Modal Submit5
Interaction Data
Application Command Data Structure
FieldTypeDescription
idsnowflakethe ID of the invoked command
namestringthe name of the invoked command
typeintegerthe type of the invoked command
resolved?resolved dataconverted users + roles + channels + attachments
options?*array of application command interaction data optionthe params + values from the user
guild_id?snowflakethe id of the guild the command is registered to
target_id?snowflakeid of the user or message targeted by a user or message command

* This can be partial when in response to APPLICATION_COMMAND_AUTOCOMPLETE

Message Component Data Structure
FieldTypeDescription
custom_idstringthe custom_id of the component
component_typeintegerthe type of the component
values?*array of select option valuesvalues the user selected in a select menu component
resolved?resolved dataresolved entities from selected options

* This is always present for select menu components

Modal Submit Data Structure
FieldTypeDescription
custom_idstringthe custom_id of the modal
componentsarray of message componentsthe values submitted by the user
Resolved Data Structure
FieldTypeDescription
users?Map of Snowflakes to user objectsthe ids and User objects
members?*Map of Snowflakes to partial member objectsthe ids and partial Member objects
roles?Map of Snowflakes to role objectsthe ids and Role objects
channels?**Map of Snowflakes to partial channel objectsthe ids and partial Channel objects
messages?Map of Snowflakes to partial messages objectsthe ids and partial Message objects
attachments?Map of Snowflakes to attachment objectsthe ids and attachment objects

* Partial Member objects are missing user, deaf and mute fields ** Partial Channel objects only have id, name, type and permissions fields. Threads will also have thread_metadata and parent_id fields.

Application Command Interaction Data Option Structure
FieldTypeDescription
namestringName of the parameter
typeintegerValue of application command option type
value?string, integer, double, or booleanValue of the option resulting from user input
options?array of application command interaction data optionPresent if this option is a group or subcommand
focused?booleantrue if this option is the currently focused option for autocomplete
Message Interaction Structure
FieldTypeDescription
idsnowflakeID of the interaction
typeinteraction typeType of interaction
namestringName of the application command, including subcommands and subcommand groups
useruser objectUser who invoked the interaction
member?partial member objectMember who invoked the interaction in the guild
Interaction Response Structure
FieldTypeDescription
typeinteraction callback typethe type of response
data?interaction callback dataan optional response message
Interaction Callback Type
NameValueDescription
Pong1ACK a Ping
Channel Message With Source4respond to an interaction with a message
Deferred Channel Message With Source5ACK an interaction and edit a response later, the user sees a loading state
Deferred Update Message*6for components, ACK an interaction and edit the original message later; the user does not see a loading state
Update Message*7for components, edit the message the component was attached to
Application Command Autocomplete Result8respond to an autocomplete interaction with suggested choices
Modal**9respond to an interaction with a popup modal
Premium Required***10respond to an interaction with an upgrade button, only available for apps with monetization enabled

* Only valid for component-based interactions. ** Not available for MODAL_SUBMIT and PING interactions. *** Not available for APPLICATION_COMMAND_AUTOCOMPLETE and PING interactions.

Interaction Callback Data Structure
Messages
FieldTypeDescription
tts?booleanis the response TTS
content?stringmessage content
embeds?array of embedssupports up to 10 embeds
allowed_mentions?allowed mentionsallowed mentions object
flags?integermessage flags combined as a bitfield (only SUPPRESS_EMBEDS and EPHEMERAL can be set)
components?array of componentsmessage components
attachments? *array of partial attachment objectsattachment objects with filename and description
Autocomplete
FieldTypeDescription
choicesarray of choicesautocomplete choices (max of 25 choices)
Modal
FieldTypeDescription
custom_idstringa developer-defined identifier for the modal, max 100 characters
titlestringthe title of the popup modal, max 45 characters
componentsarray of componentsbetween 1 and 5 (inclusive) components that make up the modal

Invite

Invite Object
FieldTypeDescription
codestringthe invite code (unique ID)
guild?partial guild objectthe guild this invite is for
channel?partial channel objectthe channel this invite is for
inviter?user objectthe user who created the invite
target_type?numberthe type of target for this voice channel invite
target_user?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_presence_count?numberapproximate count of online members, when with_counts is true
approximate_member_count?numberapproximate count of total members, when with_counts is true
expires_at??ISO8601 timestampthe expiration date of this invite, when with_expiration is true
guild_scheduled_event?guild scheduled event objectguild scheduled event data, only included if guild_scheduled_event_id contains a valid guild scheduled event id
Invite Target Types
TypeValue
STREAM1
EMBEDDED_APPLICATION2
Invite Metadata Object
FieldTypeDescription
usesnumbernumber of times this invite has been used
max_usesnumbermax number of times this invite can be used
max_agenumberduration (in seconds) after which the invite expires
temporarybooleanwhether this invite only grants temporary membership
created_atISO8601 timestampwhen this invite was created

Application

Application Object
FieldTypeDescription
idsnowflakeID of the app
namestringName of the app
icon?stringIcon hash of the app
descriptionstringDescription of the app
rpc_origins?array of stringsList of RPC origin URLs, if RPC is enabled
bot_publicbooleanWhen false, only the app owner can add the app to guilds
bot_require_code_grantbooleanWhen true, the app's bot will only join upon completion of the full OAuth2 code grant flow
bot?partial user objectPartial user object for the bot user associated with the app
terms_of_service_url?stringURL of the app's Terms of Service
privacy_policy_url?stringURL of the app's Privacy Policy
owner?partial user objectPartial user object for the owner of the app
verify_keystringHex encoded key for verification in interactions and the GameSDK's GetTicket
team?team objectIf the app belongs to a team, this will be a list of the members of that team
guild_id?snowflakeGuild associated with the app. For example, a developer support server.
guild?partial guild objectPartial object of the associated guild
primary_sku_id?snowflakeIf this app is a game sold on Discord, this field will be the id of the "Game SKU" that is created, if exists
slug?stringIf this app is a game sold on Discord, this field will be the URL slug that links to the store page
cover_image?stringApp's default rich presence invite cover image hash
flags?numberApp's public flags
approximate_guild_count?numberApproximate count of guilds the app has been added to
redirect_uris?array of stringsArray of redirect URIs for the app
interactions_endpoint_url?stringInteractions endpoint URL for the app
role_connections_verification_url?stringRole connection verification URL for the app
tags?array of stringsList of tags describing the content and functionality of the app. Max of 5 tags
install_params?install params objectSettings for the app's default in-app authorization link, if enabled
custom_install_url?stringDefault custom authorization URL for the app, if enabled
Example Application Object
{
  "bot_public": true,
  "bot_require_code_grant": false,
  "cover_image": "31deabb7e45b6c8ecfef77d2f99c81a5",
  "description": "Test",
  "guild_id": "290926798626357260",
  "icon": null,
  "id": "172150183260323840",
  "name": "Baba O-Riley",
  "owner": {
    "avatar": null,
    "discriminator": "1738",
    "flags": 1024,
    "id": "172150183260323840",
    "username": "i own a bot"
  },
  "primary_sku_id": "172150183260323840",
  "slug": "test",
  "summary": "",
  "team": {
    "icon": "dd9b7dcfdf5351b9c3de0fe167bacbe1",
    "id": "531992624043786253",
    "members": [
      {
        "membership_state": 2,
        "permissions": ["*"],
        "team_id": "531992624043786253",
        "user": {
          "avatar": "d9e261cd35999608eb7e3de1fae3688b",
          "discriminator": "0001",
          "id": "511972282709709995",
          "username": "Mr Owner"
        }
      }
    ]
  },
  "verify_key": "1e0a356058d627ca38a5c8c9648818061d49e49bd9da9e3ab17d98ad4d6bg2u8"
}
Application Flags
ValueNameDescription
1 << 6Application Auto Moderation Rule Create BadgeIndicates if an app uses the Auto Moderation API
1 << 12Gateway PresenceIntent required for bots in 100 or more servers to receive presence_update events
1 << 13Gateway Presence LimitedIntent required for bots in under 100 servers to receive presence_update events, found on the Bot page in your app's settings
1 << 14Gateway Guild MembersIntent required for bots in 100 or more servers to receive member-related events like guild_member_add.
1 << 15Gateway Guild Members LimitedIntent required for bots in under 100 servers to receive member-related events like guild_member_add, found on the Bot page in your app's settings.
1 << 16Verification Pending Guild LimitIndicates unusual growth of an app that prevents verification
1 << 17EmbeddedIndicates if an app is embedded within the Discord client (currently unavailable publicly)
1 << 18Gateway Message ContentIntent required for bots in 100 or more servers to receive message content
1 << 19Gateway Message Content LimitedIntent required for bots in under 100 servers to receive message content, found on the Bot page in your app's settings
1 << 23Application Command BadgeIndicates if an app has registered global application commands
Install Params Object
FieldTypeDescription
scopesarray of stringsScopes to add the application to the server with
permissionsstringPermissions to request for the bot role
OAuth2 Scopes
NameDescription
activities.readallows your app to fetch data from a user's "Now Playing/Recently Played" list — not currently available for apps
activities.writeallows your app to update a user's activity - not currently available for apps (NOT REQUIRED FOR GAMESDK ACTIVITY MANAGER)
applications.builds.readallows your app to read build data for a user's applications
applications.builds.uploadallows your app to upload/update builds for a user's applications - requires Discord approval
applications.commandsallows your app to add commands to a guild - included by default with the bot scope
applications.commands.updateallows your app to update its commands using a Bearer token - client credentials grant only
applications.commands.permissions.updateallows your app to update permissions for its commands in a guild a user has permissions to
applications.entitlementsallows your app to read entitlements for a user's applications
applications.store.updateallows your app to read and update store data (SKUs, store listings, achievements, etc.) for a user's applications
botfor oauth2 bots, this puts the bot in the user's selected guild by default
connectionsallows /users/@me/connections to return linked third-party accounts
dm_channels.readallows your app to see information about the user's DMs and group DMs - requires Discord approval
emailenables /users/@me to return an email
gdm.joinallows your app to join users to a group dm
guildsallows /users/@me/guilds to return basic information about all of a user's guilds
guilds.joinallows /guilds/{guild.id}/members/{user.id} to be used for joining users to a guild
guilds.members.readallows /users/@me/guilds/{guild.id}/member to return a user's member information in a guild
identifyallows /users/@me without email
messages.readfor local rpc server api access, this allows you to read messages from all client channels (otherwise restricted to channels/guilds your app creates)
relationships.readallows your app to know a user's friends and implicit relationships - requires Discord approval
role_connections.writeallows your app to update a user's connection and metadata for the app
rpcfor local rpc server access, this allows you to control a user's local Discord client - requires Discord approval
rpc.activities.writefor local rpc server access, this allows you to update a user's activity - requires Discord approval
rpc.notifications.readfor local rpc server access, this allows you to receive notifications pushed out to the user - requires Discord approval
rpc.voice.readfor local rpc server access, this allows you to read a user's voice settings and listen for voice events - requires Discord approval
rpc.voice.writefor local rpc server access, this allows you to update a user's voice settings - requires Discord approval
voiceallows your app to connect to voice on user's behalf and see all the voice members - requires Discord approval
webhook.incomingthis generates a webhook that is returned in the oauth token response for authorization code grants
Application Command Object
FieldTypeDescriptionValid Types
idsnowflakeUnique ID of commandall
type?numberType of command, defaults to 1all
application_idsnowflakeID of the parent applicationall
guild_id?snowflakeGuild ID of the command, if not globalall
namestringName of command, 1-32 charactersall
name_localizations??dictionary with keys in available localesLocalization dictionary for name field. Values follow the same restrictions as nameall
descriptionstringDescription for CHAT_INPUT commands, 1-100 characters. Empty string for USER and MESSAGE commandsall
description_localizations??dictionary with keys in available localesLocalization dictionary for description field. Values follow the same restrictions as descriptionall
options?array of application command optionParameters for the command, max of 25CHAT_INPUT
default_member_permissions?stringSet of permissions represented as a bit setall
dm_permission?booleanIndicates whether the command is available in DMs with the app, only for globally-scoped commandsall
nsfw?booleanIndicates whether the command is age-restricted, defaults to falseall
versionsnowflakeAutoincrementing version identifier updated during substantial record changesall

Set default_member_permissions to "0" to disable the command for everyone except admins by default, and/or set dm_permission to false to disable globally-scoped commands inside of DMs with your app

Application Command Types
NameTypeDescription
Chat Input1Slash commands; a text-based command that shows up when a user types /
User2A UI-based command that shows up when you right click or tap on a user
Message3A UI-based command that shows up when you right click or tap on a message
Application Command Option Structure

Required options must be listed before optional options

FieldTypeDescription
typeone of application command option typeType of option
namestring1-32 character name
name_localizations??dictionary with keys in available localesLocalization dictionary for the name field. Values follow the same restrictions as name
descriptionstring1-100 character description
description_localizations??dictionary with keys in available localesLocalization dictionary for the description field. Values follow the same restrictions as description
required?booleanIf the parameter is required or optional--default false
choices?array of application command option choiceChoices for STRING, INTEGER, and NUMBER types for the user to pick from, max 25
options?array of application command optionIf the option is a subcommand or subcommand group type, these nested options will be the parameters
channel_types?array of channel typesIf the option is a channel type, the channels shown will be restricted to these types
min_value?number for INTEGER options, double for NUMBER optionsIf the option is an INTEGER or NUMBER type, the minimum value permitted
max_value?number for INTEGER options, double for NUMBER optionsIf the option is an INTEGER or NUMBER type, the maximum value permitted
min_length?numberFor option type STRING, the minimum allowed length (minimum of 0, maximum of 6000)
max_length?numberFor option type STRING, the maximum allowed length (minimum of 1, maximum of 6000)
autocomplete? *booleanIf autocomplete interactions are enabled for this STRING, INTEGER, or NUMBER type option

* autocomplete may not be set to true if choices are present. • Options using autocomplete are not confined to only use choices given by the application.

Application Command Option Type
NameValueNote
Sub Command1
Sub Command Group2
String3
Integer4Any integer between -2^53 and 2^53
Boolean5
User6
Channel7Includes all channel types + categories
Role8
Mentionable9Includes users and roles
Number10Any double between -2^53 and 2^53
Attachment11attachment object
Application Command Option Choice Structure

• If you specify choices for an option, they are the only valid values for a user to pick

FieldTypeDescription
namestring1-100 character choice name
name_localizations??dictionary with keys in available localesLocalization dictionary for the name field. Values follow the same restrictions as name
valuestring, integer, or double *Value for the choice, up to 100 characters if string

* Type of value depends on the option type that the choice belongs to.

Application Command Permissions Object

• Returned when fetching the permissions for an app's command(s) in a guild.

FieldTypeDescription
idsnowflakeID of the command or the application ID
application_idsnowflakeID of the application the command belongs to
guild_idsnowflakeID of the guild
permissionsarray of application command permissionsPermissions for the command in the guild, max of 100

• When the id field is the application ID instead of a command ID, the permissions apply to all commands that do not contain explicit overwrites.

Application Command Permissions Structure

• Application command permissions allow you to enable or disable commands for specific users, roles, or channels within a guild.

FieldTypeDescription
idsnowflakeID of the role, user, or channel. It can also be permission constant
typeapplication command permission typerole (1), user (2), or channel (3)
permissionbooleantrue to allow, false, to disallow
Application Command Permissions Constants

• The following constants can be used in the id field for command permissions payloads.

PermissionValueTypeDescription
@everyoneguild_idsnowflakeAll members in a guild
All Channelsguild_id - 1snowflakeAll channels in a guild
Application Command Permission Type
NameValue
Role1
User2
Channel3
Role Subscription Data Object
FieldTypeDescription
role_subscription_listing_idsnowflakethe id of the sku and listing that the user is subscribed to
tier_namestringthe name of the tier that the user is subscribed to
total_months_subscribedintegerthe cumulative number of months that the user has been subscribed for
is_renewalbooleanwhether this notification is for a renewal rather than a new purchase
Entitlement Object
FieldTypeDescription
idsnowflakeID of the entitlement
sku_idsnowflakeID of the SKU
application_idsnowflakeID of the parent application
user_id?snowflakeID of the user that is granted access to the entitlement's sku
typenumberType of entitlement
deletedbooleanEntitlement was deleted
starts_at?ISO8601 timestampStart date at which the entitlement is valid. Not present when using test entitlements.
ends_at?ISO8601 timestampDate at which the entitlement is no longer valid. Not present when using test entitlements.
guild_id?snowflakeID of the guild that is granted access to the entitlement's sku
Entitlement Example
{
    "id": "1019653849998299136",
    "sku_id": "1019475255913222144",
    "application_id": "1019370614521200640",
    "user_id": "771129655544643584",
    "promotion_id": null,
    "type": 8,
    "deleted": false,
    "gift_code_flags": 0,
    "consumed": false,
    "starts_at": "2022-09-14T17:00:18.704163+00:00",
    "ends_at": "2022-10-14T17:00:18.704163+00:00",
    "guild_id": "1015034326372454400",
    "subscription_id": "1019653835926409216"
}
Entitlement Types
TypeValueDescription
Application Subscription8Entitlement was purchased as an app subscription
SKU Object
FieldTypeDescription
idsnowflakeID of SKU
typenumberType of SKU
application_idsnowflakeID of the parent application
namestringCustomer-facing name of your premium offering
slugstringSystem-generated URL slug based on the SKU's name
flagsnumberSKU flags combined as a bitfield
SKU Example
{
    "id": "1088510058284990888",
    "type": 5,
    "dependent_sku_id": null,
    "application_id": "788708323867885999",
    "manifest_labels": null,
    "access_type": 1,
    "name": "Test Premium",
    "features": [],
    "release_date": null,
    "premium": false,
    "slug": "test-premium",
    "flags": 128,
    "show_age_gate": false
}
SKU Types

• For subscriptions, SKUs will have a type of either SUBSCRIPTION represented by type: 5 or SUBSCRIPTION_GROUP represented by type:6. • For any current implementations, you will want to use the SKU defined by type: 5. • A SUBSCRIPTION_GROUP is automatically created for each SUBSCRIPTION SKU and are not used at this time.

TypeValueDescription
Subscription5Represents a recurring subscription
Subscription Group6System-generated group for each SUBSCRIPTION SKU created
SKU Flags

• For subscriptions, there are two types of access levels you can offer to users:

  • Guild Subscriptions: A subscription purchased by a user and applied to a single server. Everyone in that server gets your premium benefits.
  • User Subscriptions: A subscription purchased by a user for themselves. They get access to your premium benefits in every server.

• The flags field can be used to differentiate user and server subscriptions with a bitwise && operator.

TypeValueDescription
Available1 << 2SKU is available for purchase
Guild Subscription1 << 7Recurring SKU that can be purchased by a user and applied to a single server. Grants access to every user in that server.
User Subscription1 << 8Recurring SKU purchased by a user for themselves. Grants access to the purchasing user in every server.

Audit Log

Audit Log Object
FieldTypeDescription
application_commandsarray of application commands objectsList of application commands referenced in the audit log
audit_log_entriesarray of audit log entry objectsList of audit log entries, sorted from most to least recent
auto_moderation_rulesarray of auto moderation rule objectsList of auto moderation rules referenced in the audit log
guild_scheduled_eventsarray of guild scheduled event objectsList of guild scheduled events referenced in the audit log
integrationsarray of partial integration objectsList of partial integration objects
threadsarray of thread-specific channel objectsList of threads referenced in the audit log*
usersarray of user objectsList of users referenced in the audit log
webhooksarray of webhook objectsList of webhooks referenced in the audit log

* Threads referenced in THREAD_CREATE and THREAD_UPDATE events are included in the threads map since archived threads might not be kept in memory by clients.

Example Partial Integration Object
{
  "id": "33590653072239123",
  "name": "A Name",
  "type": "twitch",
  "account": {
    "name": "twitchusername",
    "id": "1234567"
  },
  "application_id": "94651234501213162"
}
Audit Log Entry Object
FieldTypeDescription
target_id?stringID of the affected entity (webhook, user, role, etc.)
changes?array of audit log change objectsChanges made to the target_id
user_id?snowflakeUser or app that made the changes
idsnowflakeID of the entry
action_typeaudit log eventType of action that occurred
options?optional audit entry infoAdditional info for certain event types
reason?stringReason for the change (1-512 characters)

• For APPLICATION_COMMAND_PERMISSION_UPDATE events, the target_id is the command ID or the app ID since the changes array represents the entire permissions property on the guild permissions object.

Audit Log Events

• The table below lists audit log events and values (the action_type field) that your app may receive.

• The Object Changed column notes which object's values may be included in the entry. • Though there are exceptions, possible keys in the changes array typically correspond to the object's fields. • The descriptions and types for those fields can be found in the linked documentation for the object.

• If no object is noted, there won't be a changes array in the entry, though other fields like the target_id still exist and many have fields in the options array.

EventValueDescriptionObject Changed
Guild Update1Server settings were updatedGuild
Channel Create10Channel was createdChannel
Channel Update11Channel settings were updatedChannel
Channel Delete12Channel was deletedChannel
Channel Overwrite Create13Permission overwrite was added to a channelChannel Overwrite
Channel Overwrite Update14Permission overwrite was updated for a channelChannel Overwrite
Channel Overwrite Delete15Permission overwrite was deleted from a channelChannel Overwrite
Member Kick20Member was removed from server
Member Prune21Members were pruned from server
Member Ban Add22Member was banned from server
Member Ban Remove23Server ban was lifted for a member
Member Update24Member was updated in serverMember
Member Role Update25Member was added or removed from a rolePartial Role*
Member Move26Member was moved to a different voice channel
Member Disconnect27Member was disconnected from a voice channel
Bot Add28Bot user was added to server
Role Create30Role was createdRole
Role Update31Role was editedRole
Role Delete32Role was deletedRole
Invite Create40Server invite was createdInvite and Invite Metadata*
Invite Update41Server invite was updatedInvite and Invite Metadata*
Invite Delete42Server invite was deletedInvite and Invite Metadata*
Webhook Create50Webhook was createdWebhook*
Webhook Update51Webhook properties or channel were updatedWebhook*
Webhook Delete52Webhook was deletedWebhook*
Emoji Create60Emoji was createdEmoji
Emoji Update61Emoji name was updatedEmoji
Emoji Delete62Emoji was deletedEmoji
Message Delete72Single message was deleted
Message Bulk Delete73Multiple messages were deleted
Message Pin74Message was pinned to a channel
Message Unpin75Message was unpinned from a channel
Integration Create80App was added to serverIntegration
Integration Update81App was updated (as an example, its scopes were updated)Integration
Integration Delete82App was removed from serverIntegration
Stage Instance Create83Stage instance was created (stage channel becomes live)Stage Instance
Stage Instance Update84Stage instance details were updatedStage Instance
Stage Instance Delete85Stage instance was deleted (stage channel no longer live)Stage Instance
Sticker Create90Sticker was createdSticker
Sticker Update91Sticker details were updatedSticker
Sticker Delete92Sticker was deletedSticker
Guild Scheduled Event Create100Event was createdGuild Scheduled Event
Guild Scheduled Event Update101Event was updatedGuild Scheduled Event
Guild Scheduled Event Delete102Event was cancelledGuild Scheduled Event
Thread Create110Thread was created in a channelThread
Thread Update111Thread was updatedThread
Thread Delete112Thread was deletedThread
Application Command Permission Update121Permissions were updated for a commandCommand Permission*
Auto Moderation Rule Create140Auto Moderation rule was createdAuto Moderation Rule
Auto Moderation Rule Update141Auto Moderation rule was updatedAuto Moderation Rule
Auto Moderation Rule Delete142Auto Moderation rule was deletedAuto Moderation Rule
Auto Moderation Block Message143Message was blocked by Auto Moderation
Auto Moderation Flag To Channel144Message was flagged by Auto Moderation
Auto Moderation User Communication Disabled145Member was timed out by Auto Moderation
Creator Monetization Request Created150Creator monetization request was created
Creator Monetization Terms Accepted151Creator monetization terms were accepted

* Object has exception(s) to available keys. See the exceptions section below for details.

Optional Audit Entry Info
FieldTypeDescriptionEvent Types
application_idsnowflakeID of the app whose permissions were targetedAPPLICATION_COMMAND_PERMISSION_UPDATE
auto_moderation_rule_namestringName of the Auto Moderation rule that was triggeredAUTO_MODERATION_BLOCK_MESSAGE & AUTO_MODERATION_FLAG_TO_CHANNEL & AUTO_MODERATION_USER_COMMUNICATION_DISABLED
auto_moderation_rule_trigger_typestringTrigger type of the Auto Moderation rule that was triggeredAUTO_MODERATION_BLOCK_MESSAGE & AUTO_MODERATION_FLAG_TO_CHANNEL & AUTO_MODERATION_USER_COMMUNICATION_DISABLED
channel_idsnowflakeChannel in which the entities were targetedMEMBER_MOVE & MESSAGE_PIN & MESSAGE_UNPIN & MESSAGE_DELETE & STAGE_INSTANCE_CREATE & STAGE_INSTANCE_UPDATE & STAGE_INSTANCE_DELETE & AUTO_MODERATION_BLOCK_MESSAGE & AUTO_MODERATION_FLAG_TO_CHANNEL & AUTO_MODERATION_USER_COMMUNICATION_DISABLED
countstringNumber of entities that were targetedMESSAGE_DELETE & MESSAGE_BULK_DELETE & MEMBER_DISCONNECT & MEMBER_MOVE
delete_member_daysstringNumber of days after which inactive members were kickedMEMBER_PRUNE
idsnowflakeID of the overwritten entityCHANNEL_OVERWRITE_CREATE & CHANNEL_OVERWRITE_UPDATE & CHANNEL_OVERWRITE_DELETE
members_removedstringNumber of members removed by the pruneMEMBER_PRUNE
message_idsnowflakeID of the message that was targetedMESSAGE_PIN & MESSAGE_UNPIN
role_namestringName of the role if type is "0" (not present if type is "1")CHANNEL_OVERWRITE_CREATE & CHANNEL_OVERWRITE_UPDATE & CHANNEL_OVERWRITE_DELETE
typestringType of overwritten entity - role ("0") or member ("1")CHANNEL_OVERWRITE_CREATE & CHANNEL_OVERWRITE_UPDATE & CHANNEL_OVERWRITE_DELETE
integration_typestringThe type of integration which performed the actionMEMBER_KICK & MEMBER_ROLE_UPDATE
Audit Log Change Object

• Many audit log events include a changes array in their entry object. • The structure for the individual changes varies based on the event type and its changed objects, so apps shouldn't depend on a single pattern of handling audit log events.

Audit Log Change Structure

• Some events don't follow the same pattern as other audit log events.

If new_value is not present in the change object while old_value is, it indicates that the property has been reset or set to null. If old_value isn't included, it indicated that the property was previously null.

FieldTypeDescription
new_value?mixed (matches object field's type)New value of the key
old_value?mixed (matches object field's type)Old value of the key
keystringName of the changed entity, with a few exceptions
Audit Log Change Exceptions

• For most objects, the change keys may be any field on the changed object. The following table details the exceptions to this pattern.

Object ChangedChange Key ExceptionsChange Object Exceptions
Command Permissionsnowflake as keyThe changes array contains objects with a key field representing the entity whose command was affected (role, channel, or user ID), a previous permissions object (with an old_value key), and an updated permissions object (with a new_value key)
Invite and Invite MetadataAdditional channel_id key (instead of object's channel.id)
Partial Role$add and $remove as keysnew_value is an array of objects that contain the role id and name
Webhookavatar_hash key (instead of avatar)

Auto Moderation

Auto Moderation Rule Structure
FieldTypeDescription
idsnowflakethe id of this rule
guild_idsnowflakethe id of the guild which this rule belongs to
namestringthe rule name
creator_idsnowflakethe user which first created this rule
event_typeintegerthe rule event type
trigger_typeintegerthe rule trigger type
trigger_metadataobjectthe rule trigger metadata
actionsarray of action objectsthe actions which will execute when the rule is triggered
enabledbooleanwhether the rule is enabled
exempt_rolesarray of snowflakesthe role ids that should not be affected by the rule (Maximum of 20)
exempt_channelsarray of snowflakesthe channel ids that should not be affected by the rule (Maximum of 50)
Example Auto Moderation Rule
{
  "id": "969707018069872670",
  "guild_id": "613425648685547541",
  "name": "Keyword Filter 1",
  "creator_id": "423457898095789043",
  "trigger_type": 1,
  "event_type": 1,
  "actions": [
    {
      "type": 1,
      "metadata": { "custom_message": "Please keep financial discussions limited to the #finance channel" }
    },
    {
      "type": 2,
      "metadata": { "channel_id": "123456789123456789" }
    },
    {
      "type": 3,
      "metadata": { "duration_seconds": 60 }
    }
  ],
  "trigger_metadata": {
    "keyword_filter": ["cat*", "*dog", "*ana*", "i like c++"],
    "regex_patterns": ["(b|c)at", "^(?:[0-9]{1,3}\\.){3}[0-9]{1,3}$"]
  },
  "enabled": true,
  "exempt_roles": ["323456789123456789", "423456789123456789"],
  "exempt_channels": ["523456789123456789"]
}
Trigger Types

• Characterizes the type of content which can trigger the rule.

Trigger TypeValueDescriptionMax per Guild
Keyword1check if content contains words from a user defined list of keywords6
Spam3check if content represents generic spam1
Keyword Preset4check if content contains words from internal pre-defined wordsets1
Mention Spam5check if content contains more unique mentions than allowed1
Trigger Metadata

• Additional data used to determine whether a rule should be triggered. • Different fields are relevant based on the value of trigger_type.

FieldTypeAssociated Trigger TypesDescription
keyword_filterarray of strings *KEYWORDsubstrings which will be searched for in content (Maximum of 1000)
regex_patternsarray of strings **KEYWORDregular expression patterns which will be matched against content (Maximum of 10)
presetsarray of keyword preset typesKEYWORD_PRESETthe internally pre-defined wordsets which will be searched for in content
allow_listarray of strings ***KEYWORD, KEYWORD_PRESETsubstrings which should not trigger the rule (Maximum of 100 or 1000)
mention_total_limitintegerMENTION_SPAMtotal number of unique role and user mentions allowed per message (Maximum of 50)
mention_raid_protection_enabledbooleanMENTION_SPAMwhether to automatically detect mention raids

* A keyword can be a phrase which contains multiple words. Wildcard symbols can be used to customize how each keyword will be matched. Each keyword must be 60 characters or less. ** Only Rust flavored regex is currently supported, which can be tested in online editors such as Rustexp. Each regex pattern must be 260 characters or less. *** Each allow_list keyword can be a phrase which contains multiple words. Wildcard symbols can be used to customize how each keyword will be matched. Rules with KEYWORD trigger_type accept a maximum of 100 keywords. Rules with KEYWORD_PRESET trigger_type accept a maximum of 1000 keywords.

Trigger Metadata Field Limits
FieldTrigger TypeMAX ARRAY LENGTHMAX CHARACTERS PER STRING
keyword_filterKEYWORD100060
regex_patternsKEYWORD10260
allow_listKEYWORD10060
allow_listKEYWORD_PRESET100060
Keyword Preset Types
Preset TypeValueDescription
Profanity1words that may be considered forms of swearing or cursing
Sexual Content2words that refer to sexually explicit behavior or activity
Slurs3personal insults or words that may be considered hate speech
Event Types

• Indicates in what event context a rule should be checked.

Event TypeValueDescription
Message Send1when a member sends or edits a message in the guild
Keyword Matching Strategies

• Use the wildcard symbol (*) at the beginning or end of a keyword to define how it should be matched. All keywords are case insensitive.

Prefix - word must start with the keyword

KeywordMatches
cat*catch, Catapult, CAttLE
tra*train, trade, TRAditional
the mat*the matrix

Suffix - word must end with the keyword

KeywordMatches
*catwildcat, copyCat
*traextra, ultra, orchesTRA
*the matbreathe mat

Anywhere - keyword can appear anywhere in the content

KeywordMatches
*cat*location, eduCation
*tra*abstracted, outrage
*the mat*breathe matter

Whole Word - keyword is a full word or phrase and must be surrounded by whitespace

KeywordMatches
catcat
traintrain
the matthe mat
Auto Moderation Action Object

• An action which will execute whenever a rule is triggered.

FieldTypeDescription
typeaction typethe type of action
metadata? *action metadataadditional metadata needed during execution for this specific action type

* Can be omitted based on type. See the Associated Action Types column in action metadata to understand which type values require metadata to be set.

Action Types
Action TypeValueDescription
Block Message1blocks a member's message and prevents it from being posted. A custom explanation can be specified and shown to members whenever their message is blocked.
Send Alert Message2logs user content to a specified channel
Timeout3timeout user for a specified duration *

* A TIMEOUT action can only be set up for KEYWORD and MENTION_SPAM rules. The MODERATE_MEMBERS permission is required to use the TIMEOUT action type.

Action Metadata

• Additional data used when an action is executed. • Different fields are relevant based on the value of action type.

FieldTypeAssociated Action TypesDescriptionConstraints
channel_idsnowflakeSend Alert Messagechannel to which user content should be loggedexisting channel
duration_secondsintegerTimeouttimeout duration in secondsmaximum of 2419200 seconds (4 weeks)
custom_message?stringBlock Messageadditional explanation that will be shown to members whenever their message is blockedmaximum of 150 characters
Stage Instance Object
FieldTypeDescription
idsnowflakeThe id of this Stage instance
guild_idsnowflakeThe guild id of the associated Stage channel
channel_idsnowflakeThe id of the associated Stage channel
topicstringThe topic of the Stage instance (1-120 characters)
privacy_levelnumberThe privacy level of the Stage instance
discoverable_disabledbooleanWhether or not Stage Discovery is disabled (deprecated)
guild_scheduled_event_id?snowflakeThe id of the scheduled event for this Stage instance
Privacy Level
LevelValueDescription
Public1The Stage instance is visible publicly. (deprecated)
Guild Only2The Stage instance is visible to only guild members.

Keywords

FAQs

Package last updated on 30 Aug 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc