Corsair
PluginsDiscord

Discord API Endpoints

Complete reference for all Discord API endpoints

The Discord plugin provides access to Discord's REST API through a typed interface. All endpoints automatically handle authentication and error handling.

New to Corsair? Learn about core concepts like API access, authentication, and error handling.

Full Implementation: For the complete, up-to-date list, see the Discord plugin source code.

Messages

send

messages.send

Send a message to a channel.

const result = await corsair.discord.api.messages.send({
    channelId: "1234567890", 
    content: "Hello from Corsair!",
    embeds: [{ title: "Embed Title", description: "Embed body" }],
});

Parameters:

NameTypeRequiredDescription
channelIdstringYesID of the channel to send to
contentstringNoText content of the message
embedsarrayNoRich embed objects
componentsarrayNoInteractive components (buttons, menus)

reply

messages.reply

Reply to a message in a channel.

await corsair.discord.api.messages.reply({
    channelId: "1234567890",
    messageId: "0987654321", 
    content: "This is a reply!",
});

Parameters:

NameTypeRequiredDescription
channelIdstringYesChannel ID
messageIdstringYesID of the message to reply to
contentstringNoText content of the reply

get

messages.get

Get a specific message by ID.

const message = await corsair.discord.api.messages.get({
    channelId: "1234567890",
    messageId: "0987654321", 
});

Parameters:

NameTypeRequiredDescription
channelIdstringYesChannel ID
messageIdstringYesMessage ID

list

messages.list

List recent messages in a channel.

const messages = await corsair.discord.api.messages.list({
    channelId: "1234567890",
    limit: 50, 
});

Parameters:

NameTypeRequiredDescription
channelIdstringYesChannel ID
limitnumberNoMax messages to return (1-100)
beforestringNoGet messages before this message ID
afterstringNoGet messages after this message ID

edit

messages.edit

Edit an existing message.

await corsair.discord.api.messages.edit({
    channelId: "1234567890",
    messageId: "0987654321",
    content: "Updated content", 
});

Parameters:

NameTypeRequiredDescription
channelIdstringYesChannel ID
messageIdstringYesMessage ID to edit
contentstringNoNew text content
embedsarrayNoUpdated embeds

delete

messages.delete

Permanently delete a message.

await corsair.discord.api.messages.delete({
    channelId: "1234567890",
    messageId: "0987654321", 
});

Parameters:

NameTypeRequiredDescription
channelIdstringYesChannel ID
messageIdstringYesMessage ID to delete

Threads

create

threads.create

Create a new thread in a channel.

await corsair.discord.api.threads.create({
    channelId: "1234567890",
    name: "Discussion Thread", 
    autoArchiveDuration: 1440,
});

Parameters:

NameTypeRequiredDescription
channelIdstringYesParent channel ID
namestringYesThread name
autoArchiveDurationnumberNoMinutes until auto-archive (60, 1440, 4320, 10080)

createFromMessage

threads.createFromMessage

Create a thread from an existing message.

await corsair.discord.api.threads.createFromMessage({
    channelId: "1234567890",
    messageId: "0987654321", 
    name: "Thread from message",
});

Parameters:

NameTypeRequiredDescription
channelIdstringYesChannel ID
messageIdstringYesMessage to start thread from
namestringYesThread name

Reactions

add

reactions.add

Add a reaction to a message.

await corsair.discord.api.reactions.add({
    channelId: "1234567890",
    messageId: "0987654321",
    emoji: "👍", 
});

Parameters:

NameTypeRequiredDescription
channelIdstringYesChannel ID
messageIdstringYesMessage ID
emojistringYesEmoji to react with (unicode or name:id)

remove

reactions.remove

Remove a reaction from a message.

await corsair.discord.api.reactions.remove({
    channelId: "1234567890",
    messageId: "0987654321",
    emoji: "👍", 
});

Parameters:

NameTypeRequiredDescription
channelIdstringYesChannel ID
messageIdstringYesMessage ID
emojistringYesEmoji to remove

list

reactions.list

List reactions on a message.

const reactions = await corsair.discord.api.reactions.list({
    channelId: "1234567890",
    messageId: "0987654321",
    emoji: "👍", 
});

Parameters:

NameTypeRequiredDescription
channelIdstringYesChannel ID
messageIdstringYesMessage ID
emojistringYesEmoji to list users for

Guilds

list

guilds.list

List guilds the bot is a member of.

const guilds = await corsair.discord.api.guilds.list({
    limit: 100,
});

Parameters:

NameTypeRequiredDescription
limitnumberNoMax guilds to return
beforestringNoGet guilds before this ID
afterstringNoGet guilds after this ID

get

guilds.get

Get info about a specific guild.

const guild = await corsair.discord.api.guilds.get({
    guildId: "9876543210", 
});

Parameters:

NameTypeRequiredDescription
guildIdstringYesGuild (server) ID

Channels

list

channels.list

List channels in a guild.

const channels = await corsair.discord.api.channels.list({
    guildId: "9876543210", 
});

Parameters:

NameTypeRequiredDescription
guildIdstringYesGuild ID

Members

list

members.list

List members of a guild.

const members = await corsair.discord.api.members.list({
    guildId: "9876543210", 
    limit: 100,
});

Parameters:

NameTypeRequiredDescription
guildIdstringYesGuild ID
limitnumberNoMax members to return (1-1000)
afterstringNoGet members after this user ID

get

members.get

Get info about a specific guild member.

const member = await corsair.discord.api.members.get({
    guildId: "9876543210",
    userId: "1234567890", 
});

Parameters:

NameTypeRequiredDescription
guildIdstringYesGuild ID
userIdstringYesUser ID