# Discord Webhooks: Send Messages, Embeds and Files (With Rate Limits That Won't Bite)

> Send messages to Discord with a webhook: the request format, ?wait=true, embeds and their limits, file uploads, forum threads, editing, and handling 429 rate limits.

Canonical: https://tesselith.com/blog/discord-webhook-send-message
Last updated: 2026-11-27

**To send a message with a Discord webhook, POST JSON to the webhook URL (`https://discord.com/api/webhooks/{id}/{token}`) with a `content` field of up to 2,000 characters.** No bot, no OAuth and no token header: the URL itself is the credential. Add `?wait=true` to get the created message back instead of an empty `204`, so you have its id for edits and deletes. A message can carry up to 10 embeds (6,000 characters across all of them) and up to 10 files sent as multipart form data. When you hit a rate limit, Discord returns `429` with a `retry_after` value. Wait that long, then retry.

**Key takeaways**
- The webhook URL is a secret. Anyone with it can post as your webhook.
- Always add ?wait=true so you get a message id and real errors back.
- Limits: 2,000 characters of content, 10 embeds totalling 6,000 characters, 10 files.
- Use allowed_mentions to stop user-supplied text from pinging @everyone.
- Discord doesn't publish fixed webhook limits. Read the X-RateLimit headers and honour retry_after instead of hard-coding a number.

## Create a webhook

In Discord, open the channel's settings (the gear next to the channel name), go to **Integrations**, then **Webhooks**, and click **New Webhook**. Name it, pick an avatar, choose the channel, and click **Copy Webhook URL**. You need the Manage Webhooks permission on the server to see this.

Treat that URL like a password. Don't commit it, don't put it in front-end code, and don't paste it in a public issue. If it leaks, delete the webhook in the same menu and make a new one. There's no rotation, only replacement.

## Send a plain message

```bash
curl -X POST "$DISCORD_WEBHOOK_URL?wait=true" \
  -H "Content-Type: application/json" \
  -d '{
    "content": "v2.4 is live: CSV export, faster search, and a fix for the timezone bug.",
    "username": "Release Bot",
    "allowed_mentions": {"parse": []}
  }'

# {"id": "1311000000000000000", "channel_id": "...", "content": "v2.4 is live...", ...}
```

Without `wait=true`, Discord answers `204 No Content` before the message is saved, and a message that fails to save doesn't return an error. That's fine for a fire-and-forget alert. For anything you'll edit, delete or report on, always wait.

`username` and `avatar_url` override the webhook's defaults per message, so one webhook can post as "Release Bot" and "Status" without creating two. `allowed_mentions: {"parse": []}` disables all mention parsing. If any part of `content` comes from users, a CMS or an RSS feed, set it, or someone's "@everyone" in a blog title pings the whole server.

## Embeds

Embeds are the cards with a colored bar, title, description, fields and images. A message can have up to 10.

```json
{
  "embeds": [{
    "title": "Weekly report: 12 Nov to 18 Nov",
    "url": "https://example.com/reports/week-46",
    "description": "Signups up, churn flat. Full numbers below.",
    "color": 5814783,
    "fields": [
      {"name": "Signups", "value": "412", "inline": true},
      {"name": "Churn", "value": "1.9%", "inline": true}
    ],
    "image": {"url": "https://cdn.example.com/charts/week-46.png"},
    "footer": {"text": "Generated automatically"},
    "timestamp": "2026-11-19T09:00:00.000Z"
  }],
  "allowed_mentions": {"parse": []}
}
```

| Embed field | Limit (Discord docs, Nov 2026) |
| --- | --- |
| title | 256 characters |
| description | 4,096 characters |
| fields | Up to 25 per embed |
| field name / value | 256 / 1,024 characters |
| footer.text | 2,048 characters |
| author.name | 256 characters |
| All embeds in one message combined | 6,000 characters |
| Embeds per message | 10 |

The 6,000 total is the one that catches people: it sums titles, descriptions, field names and values, footers and author names across every embed. Exceed any limit and the whole request fails with `400`. `color` is a decimal integer, not a hex string: `#58B9FF` is `5814783`. Embeds with the same `url` are deduplicated, so only the first one shows.

## Sending files

Files need `multipart/form-data`. Put each file in a `files[n]` field and the JSON body in a field called `payload_json`. To show an uploaded image inside an embed, reference it as `attachment://filename`.

```ts
export async function postWithFile(webhookUrl: string, text: string, file: Blob, name: string) {
  const form = new FormData()
  form.set("payload_json", JSON.stringify({
    content: text.slice(0, 2000),
    embeds: [{ title: "Chart", image: { url: "attachment://" + name } }],
    allowed_mentions: { parse: [] },
  }))
  form.set("files[0]", file, name)

  const res = await fetch(webhookUrl + "?wait=true", { method: "POST", body: form })
  if (!res.ok) throw new Error("Discord " + res.status + ": " + (await res.text()))
  return (await res.json()).id as string
}
```

Don't set the `Content-Type` header yourself with FormData. `fetch` adds it with the boundary. Discord's docs give a default upload limit of 20 MiB per file (higher on boosted servers) and a 25 MiB maximum request size for creating a message, so several large images can fail together even when each is under the per-file limit. Resize before sending.

## Forum channels and threads

If the webhook's channel is a forum or media channel, every message has to go into a thread. Pass `thread_name` in the body to create a new post with that title, or `?thread_id=...` in the query string to post into an existing one. Send neither and the request fails. `thread_id` also works in normal text channels for posting into a thread under a message.

```bash
# New forum post
curl -X POST "$DISCORD_WEBHOOK_URL?wait=true" \
  -H "Content-Type: application/json" \
  -d '{"thread_name": "Release notes: v2.4", "content": "Full changelog inside."}'

# Reply into an existing thread
curl -X POST "$DISCORD_WEBHOOK_URL?wait=true&thread_id=1311000000000000123" \
  -H "Content-Type: application/json" \
  -d '{"content": "Hotfix 2.4.1 is out."}'
```

## Edit and delete messages

Webhooks can edit and delete their own messages, which is great for status messages that update in place ("Deploy running" to "Deploy finished") instead of spamming the channel.

```bash
# Edit
curl -X PATCH "$DISCORD_WEBHOOK_URL/messages/$MESSAGE_ID" \
  -H "Content-Type: application/json" \
  -d '{"content": "Deploy finished in 4m 12s."}'

# Delete
curl -X DELETE "$DISCORD_WEBHOOK_URL/messages/$MESSAGE_ID"
```

Add `?thread_id=` to both if the message lives in a thread. A webhook can't reply to a message with a quoted reference the way a bot can. If you need follow-ups, post them as new messages, or use a thread.

## Rate limits and 429s

Discord doesn't publish fixed per-webhook numbers, and it says plainly that limits can change. Rate limits are scoped per route and per top-level resource, and webhooks count as a top-level resource (the webhook id and token), so each webhook has its own bucket. Every response tells you where you stand:

| Header | Meaning |
| --- | --- |
| X-RateLimit-Limit | Requests allowed in the current window |
| X-RateLimit-Remaining | Requests left in this window |
| X-RateLimit-Reset | Epoch seconds when the window resets |
| X-RateLimit-Reset-After | Seconds until reset |
| X-RateLimit-Bucket | Id of the shared limit this route belongs to |
| Retry-After (on 429) | Seconds to wait before retrying |

```ts
export async function sendWithRetry(url: string, body: unknown, attempts = 4) {
  for (let i = 0; i < attempts; i++) {
    const res = await fetch(url + "?wait=true", {
      method: "POST",
      headers: { "Content-Type": "application/json" },
      body: JSON.stringify(body),
    })
    if (res.ok) return res.json()
    if (res.status === 429) {
      const { retry_after } = await res.json()
      await new Promise((r) => setTimeout(r, Math.ceil(retry_after * 1000)))
      continue
    }
    if (res.status >= 500) {
      await new Promise((r) => setTimeout(r, 1000 * 2 ** i))
      continue
    }
    // 400: bad payload. 401/404: webhook deleted or URL wrong. Don't retry.
    throw new Error("Discord " + res.status + ": " + (await res.text()))
  }
  throw new Error("Discord: gave up after retries")
}
```

Back off when `X-RateLimit-Remaining` reaches zero, rather than waiting for the 429. Discord also watches for invalid requests: apps that keep sending requests that end in 401, 403 or 429 can be temporarily blocked at the IP level. That's the practical reason not to retry a deleted webhook in a loop.

## Common failures

- **404 Unknown Webhook:** someone deleted the webhook or it was regenerated. Get a new URL. Retrying never fixes it.
- **401:** the token part of the URL is wrong, usually a copy-paste truncation.
- **400 with a field path:** an embed limit or empty message. Discord tells you which field.
- **Message posted but pings everyone:** you didn't set allowed_mentions.
- **Nothing appears and no error:** you didn't use ?wait=true, so a failed save was silent.

If you want to schedule announcements rather than wire them up in code, our guide to [scheduling Discord messages](https://tesselith.com/blog/how-to-schedule-discord-messages) covers the options, and the [Discord character counter](https://tesselith.com/free-tools/character-counter/discord) checks the 2,000 limit.

## When to use a scheduling API instead of building it yourself

For a single channel, a webhook and a cron job is the right answer. It's simpler than anything you'd buy. A scheduling tool makes sense when the same announcement also goes to Telegram, Mastodon, Bluesky or Instagram, when someone non-technical writes it, or when you want approvals, a calendar and failure alerts around it.

Discord is coming soon to [Tesselith](https://tesselith.com/schedule/discord). The [Tesselith API](https://tesselith.com/product/api) already publishes to Telegram, Bluesky, Mastodon, Threads, Instagram, Facebook Pages and YouTube with one post model and signed [webhooks](https://tesselith.com/blog/social-media-webhooks) for results. See our [scheduling API checklist](https://tesselith.com/blog/social-media-scheduling-api), the [automation walkthrough](https://tesselith.com/blog/automate-social-media-posting-api), and the [docs](https://tesselith.com/docs).

## Questions people ask

### How do I send a message to a Discord webhook?

POST JSON with a content field (up to 2,000 characters) to the webhook URL. Add ?wait=true to receive the created message, including its id.

### How many embeds can a Discord webhook message have?

Up to 10 embeds, with a combined limit of 6,000 characters across all titles, descriptions, fields, footers and author names.

### How do I send a file with a Discord webhook?

Use multipart/form-data with the file in a files[0] field and the JSON body in payload_json. Reference an uploaded image in an embed as attachment://filename.

### What is the Discord webhook rate limit?

Discord doesn't publish a fixed number. Each webhook has its own bucket; read the X-RateLimit headers and wait for retry_after when you get a 429.

### Can a Discord webhook edit its messages?

Yes. PATCH {webhook_url}/messages/{message_id} to edit and DELETE the same URL to remove a message the webhook sent.

---
Tesselith · https://tesselith.com · Full site index: https://tesselith.com/llms.txt
