DEV Community

Alex Spinov
Alex Spinov

Posted on

Discord Has a Free API — Build Bots, Read Messages, and Automate Servers (No Paid Plan Needed)

Most developers think of Discord as a chat app. But Discord exposes a full REST and WebSocket API — free, well-documented, and powerful enough to build entire products on top of.

No paid plan. No enterprise tier. Just a bot token and you're in.

What You Get for Free

  • Send and read messages in any channel your bot has access to
  • Manage servers — create channels, assign roles, kick/ban users
  • Slash commands — register custom /commands that appear in the UI
  • Voice channel access — connect bots to voice for music, transcription, etc.
  • Webhooks — post to channels from any external service (CI/CD, monitoring, alerts)
  • OAuth2 — let users log in with their Discord account
  • Rate limits: 50 requests/second per bot (generous for most use cases)

Quick Start: Send a Message in 5 Lines

import requests

TOKEN = "your-bot-token"
CHANNEL_ID = "123456789"

requests.post(
    f"https://discord.com/api/v10/channels/{CHANNEL_ID}/messages",
    headers={"Authorization": f"Bot {TOKEN}"},
    json={"content": "Hello from my bot!"}
)
Enter fullscreen mode Exit fullscreen mode

That's it. No SDK needed (though discord.py and discord.js exist if you want them).

Real Use Cases I've Built

1. Deploy notifications — GitHub Action sends a webhook to #deploys channel after every push. Team knows instantly.

2. Error alerting — Sentry webhook to Discord channel. Faster than email, more visible than Slack (free tier has no apps limit).

3. Community moderation bot — Auto-delete spam, warn users, track message velocity. Runs on a $5 VPS.

4. Daily standup bot — Posts a thread every morning at 9 AM, team replies in-thread. No standup meetings.

Getting Your Bot Token (2 Minutes)

  1. Go to discord.com/developers/applications
  2. Click "New Application" — name it — go to "Bot" tab
  3. Click "Reset Token" — copy it (store securely!)
  4. Under "OAuth2 — URL Generator": select bot scope + permissions you need
  5. Open the generated URL — add bot to your server

Webhooks: Even Simpler (No Bot Needed)

If you just want to post messages to a channel (monitoring, alerts, CI/CD):

curl -X POST "https://discord.com/api/webhooks/YOUR_WEBHOOK_URL" \
  -H "Content-Type: application/json" \
  -d '{"content": "Build #142 deployed successfully"}'
Enter fullscreen mode Exit fullscreen mode

Create a webhook: Server Settings — Integrations — Webhooks — New Webhook.

One URL. One POST. Done.

Discord vs. Slack API (Why Discord Wins for Side Projects)

Feature Discord Slack
Bot hosting Free forever Free (10 apps limit on free plan)
Webhooks Unlimited Unlimited
Message history Unlimited 90 days (free plan)
File uploads 25 MB (free), 100 MB (Nitro) 1 GB total (free plan)
Rate limits 50 req/s Varies (stricter)
Voice channels Free Huddles only
Slash commands Free Free
OAuth2 Free Free

For developer tools and side projects, Discord's free tier is simply more generous.

Advanced: Interactions and Slash Commands

Register a global slash command:

import requests

APP_ID = "your-app-id"
TOKEN = "your-bot-token"

requests.post(
    f"https://discord.com/api/v10/applications/{APP_ID}/commands",
    headers={"Authorization": f"Bot {TOKEN}"},
    json={
        "name": "status",
        "description": "Check service status",
        "type": 1
    }
)
Enter fullscreen mode Exit fullscreen mode

Users type /status in any channel — your bot receives the interaction — responds with real-time data.

The Rate Limits You Should Know

  • Global: 50 requests/second
  • Per route: varies (e.g., 5 messages/5s per channel)
  • Gateway (WebSocket): 120 events/60s for identifying
  • Webhook execute: 30/60s per webhook

For 99% of bot use cases, you'll never hit these.

What You Can't Do (Free Tier Limitations)

  • No access to other users' DMs (bots only see servers they're added to)
  • Gateway Intents for message content require verification (>100 servers)
  • No built-in scheduling — you bring your own cron/scheduler
  • Voice requires additional libraries (opus, sodium)

Links


Building scrapers, bots, or automation tools? I've published 88+ ready-made Apify actors for web scraping — Reddit, HN, Trustpilot, YouTube, and more.

Need a custom solution? spinov001@gmail.com

More "[Brand] Has a Free API" articles:
Hacker News | Supabase | Resend | CoinGecko

Top comments (0)