Send a Discord Direct Message
Send a 1:1 Direct Message from the bot to a Discord user (by snowflake ID). Supports the same payload shape as channel posts — content, embeds, media attachments, and TTS.
Constraints (Discord platform limits):
- The bot can only DM users it shares at least one guild with.
- If the recipient has DMs disabled for non-friends, Discord returns 403 (surfaces as a 502 platform error).
contentcapped at 2,000 chars.- At least one of
content,embeds, orattachmentsis required. - The recipient must be identified by Discord snowflake ID (not username).
This is a dedicated endpoint rather than a POST /v1/posts variant because
DMs are 1:1 operational messages (onboarding, billing reminders, support
pings) with a different lifecycle than scheduled channel posts. DMs are
not persisted to Post / ExternalPost and are always sent immediately.
API key authentication - use your Zernio API key as a Bearer token
In: header
SocialAccount _id of the connected Discord account the bot speaks as. Caller must own the account (directly or via team membership).
Discord snowflake ID of the recipient (15-21 digits).
Message text, up to 2,000 characters.
length <= 2000Up to 10 Discord embeds. Same shape as channel-post embeds (title, description, color, fields, etc.). See DiscordPlatformData.embeds for the embed object schema.
items <= 10Up to 10 media attachments. Each is { type: image|video|gif|document, url, filename?, mimeType?, size? }.
items <= 10Send as text-to-speech message.
Response Body
application/json
application/json
import Zernio from '@zernio/node';const zernio = new Zernio({ apiKey: process.env.ZERNIO_API_KEY });const { data } = await zernio.discord.sendDiscordDirectMessage({ body: { accountId: '65a1b2c3d4e5f60718293a4b', userId: '1234567890123456789', },});console.log(data);{
"messageId": "1357924680135792468",
"channelId": "1357924680135792467",
"url": "https://discord.com/channels/@me/1357924680135792467/1357924680135792468",
"timestamp": "2026-06-02T12:34:56.789Z",
"recipient": {
"userId": "1234567890123456789",
"platform": "discord"
},
"account": {
"id": "65a1b2c3d4e5f60718293a4b",
"username": "announcements",
"displayName": "My Server - #announcements"
}
}{
"error": "Unauthorized"
}Remove a role from a guild member DELETE
Remove one role from one member. Idempotent — removing a role the member doesn't have returns 204 no-op. Same permission + hierarchy constraints as the PUT counterpart.
Unpin a Discord message DELETE
Unpin a message. Same MANAGE_MESSAGES permission requirement as pin. Idempotent — unpinning a non-pinned message is a 204 no-op.