# Discord Scraper — Messages, Members & Server Data (`brick_joey_yto/discord-scraper`) Actor

Scrape Discord servers with a bot token — message history, member lists, channels, guild stats — or resolve invites & widget member lists anonymously. Reliable official API. From $1/1,000 results.

- **URL**: https://apify.com/brick_joey_yto/discord-scraper.md
- **Developed by:** [William Billings](https://apify.com/brick_joey_yto) (community)
- **Categories:** Social media, Developer tools, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$1.00 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Discord Scraper — Messages, Members & Server Data

Reliable Discord data export using the **official REST API** — no hijacked user sessions, no fragile tokens that die mid-run. Two paths:

- **Anonymous (no credentials)** — resolve invite links to server stats, and pull live online member lists from widget-enabled servers
- **Bot token (your servers)** — full message history, member lists, channel inventory, and guild stats for any server your bot has joined

### Modes

| Mode       | Auth      | What you get                                                                                                               |
| ---------- | --------- | -------------------------------------------------------------------------------------------------------------------------- |
| `invite`   | none      | Server name, description, member + online counts, features, verification status, boost count, channel the invite points to |
| `widget`   | none      | Live online member list (usernames, status, activity) + server channels for widget-enabled guilds                          |
| `guild`    | bot token | Guild overview: name, member counts, features, verification level, boost count                                             |
| `channels` | bot token | Every channel in the guild — name, type (text/voice/forum/stage), topic, position, NSFW flag                               |
| `messages` | bot token | Full channel history — author, content, timestamp, attachments, reactions, edits; paginates with `before` cursor           |
| `members`  | bot token | Member export — username, nickname, roles, join date, avatar (needs **Server Members** intent enabled)                     |

### Getting a bot token (2 minutes, free)

1. Go to [discord.com/developers/applications](https://discord.com/developers/applications) → New Application
2. Bot tab → copy the **token**
3. Enable **Message Content Intent** and **Server Members Intent** (same page)
4. Invite it: `https://discord.com/oauth2/authorize?client_id=<APP_ID>&scope=bot&permissions=117760`
5. Paste the token into `discordToken`

### Use cases

- **Community analytics** — track member counts and online presence across servers over time (schedule `invite` mode daily)
- **Server backup/export** — full message + member export before migration or for compliance
- **Lead research** — invite links reveal server size, niche, and engagement instantly
- **Competitor/community monitoring** — widget-enabled servers expose live online rosters

### Input

| Field                | Type   | Default          | Description                                                    |
| -------------------- | ------ | ---------------- | -------------------------------------------------------------- |
| `mode`               | string | `invite`         | `invite`, `widget`, `guild`, `channels`, `messages`, `members` |
| `discordToken`       | string | —                | Bot token (required for token modes)                           |
| `invites`            | array  | `["midjourney"]` | Invite codes or URLs for `invite` mode                         |
| `guildIds`           | array  | —                | Server IDs for `widget`/`guild`/`channels`/`members`           |
| `channelIds`         | array  | —                | Channel IDs for `messages`                                     |
| `before`             | string | —                | Resume pagination from a message snowflake                     |
| `maxResults`         | int    | `100`            | Max rows per source                                            |
| `proxyConfiguration` | object | —                | Optional Apify proxy                                           |

### Why this works when others fail

User-token (selfbot) scrapers get rate-limited and banned constantly — Discord kills those sessions on sight. This actor uses the official bot API: tokens are stable, rate limits are handled with proper backoff, and the data shape is documented.

### Example output

```json
{
  "recordType": "invite",
  "code": "midjourney",
  "guildId": "662267976984297473",
  "guildName": "Midjourney",
  "description": "The official server for Midjourney, a text-to-image AI.",
  "memberCount": 18533062,
  "onlineCount": 795934,
  "channelName": "getting-started",
  "features": ["VERIFIED", "BANNER", "WELCOME_SCREEN_ENABLED"],
  "premiumSubscriptionCount": 0,
  "url": "https://discord.gg/midjourney"
}
```

### Pricing

**$1.00 per 1,000 results** (pay-per-event). A full channel history pull of 1,000 messages costs $1. Server previews are fractions of a cent.

### FAQ

**Do I need a Discord account?** No — `invite` and `widget` modes work with zero credentials. Bot-token modes need a free bot you create in 2 minutes (steps above).

**Is my bot token safe?** Your token stays in your run input and is used only against Discord's official REST API — no user sessions, no selfbot tricks that get accounts banned.

**Can I scrape any server?** Anonymous modes resolve invite links and widget-enabled servers. Full message history and member lists require your bot to be invited to the guild — that's how Discord permissions work.

**Can I schedule it?** Yes — schedule `invite` mode daily to track member-count trends across servers, or `messages` mode with the `before` cursor for incremental channel sync.

**Is it legal to scrape this data?** The actor only accesses publicly available data — the same pages/APIs a browser sees. Scraping public data for research, monitoring, and analysis is common practice, but platform Terms of Service and the rules in your jurisdiction still apply to how you use it. Consult legal counsel for your specific case.

### More from this developer

**Monitors & business intel:** [ATS Jobs Monitor](https://apify.com/brick_joey_yto/ats-jobs-monitor) · [Sports Scores & Odds Monitor](https://apify.com/brick_joey_yto/sports-scores-odds-monitor) · [Prediction Markets Monitor](https://apify.com/brick_joey_yto/prediction-markets-monitor) · [Crypto Token Monitor](https://apify.com/brick_joey_yto/crypto-token-monitor) · [Crypto Derivatives Monitor](https://apify.com/brick_joey_yto/crypto-derivatives-monitor) · [Google News Monitor](https://apify.com/brick_joey_yto/google-news-monitor) · [App Store Monitor](https://apify.com/brick_joey_yto/app-store-monitor) · [Walmart Product Monitor](https://apify.com/brick_joey_yto/walmart-product-monitor) · [Pump.fun Monitor](https://apify.com/brick_joey_yto/memecoin-launch-monitor) · [StockTwits Scraper](https://apify.com/brick_joey_yto/stocktwits-scraper) · [Yahoo Finance Scraper](https://apify.com/brick_joey_yto/yahoo-finance-scraper) · [Product Hunt Monitor](https://apify.com/brick_joey_yto/product-hunt-monitor) · [Hacker News Monitor](https://apify.com/brick_joey_yto/hackernews-monitor) · [AI Visibility Tracker](https://apify.com/brick_joey_yto/ai-brand-monitor)

**Alt-social & OSINT:** [Gab Scraper](https://apify.com/brick_joey_yto/gab-search-scraper) · [BitChute Scraper](https://apify.com/brick_joey_yto/bitchute-search-scraper) · [Truth Social Scraper](https://apify.com/brick_joey_yto/truth-social-scraper) · [Telegram Scraper](https://apify.com/brick_joey_yto/telegram-scraper) · [Rumble Video Scraper](https://apify.com/brick_joey_yto/rumble-video-scraper) · [Odysee Scraper](https://apify.com/brick_joey_yto/odysee-scraper) · [Kick Scraper](https://apify.com/brick_joey_yto/kick-scraper) · [4chan Scraper](https://apify.com/brick_joey_yto/4chan-scraper) · [Bitcointalk Scraper](https://apify.com/brick_joey_yto/bitcointalk-scraper) · [Xiaohongshu / RedNote Scraper](https://apify.com/brick_joey_yto/xiaohongshu-scraper)

**Creator platforms:** [Bluesky Scraper](https://apify.com/brick_joey_yto/bluesky-search-scraper) · [Threads Scraper](https://apify.com/brick_joey_yto/threads-profile-scraper) · [Farcaster Scraper](https://apify.com/brick_joey_yto/farcaster-scraper) · [Spoutible Scraper](https://apify.com/brick_joey_yto/spoutible-scraper) · [Pixelfed Scraper](https://apify.com/brick_joey_yto/pixelfed-scraper) · [Substack Notes Scraper](https://apify.com/brick_joey_yto/substack-notes-scraper) · [Dailymotion Scraper](https://apify.com/brick_joey_yto/dailymotion-scraper) · [Roblox Scraper](https://apify.com/brick_joey_yto/roblox-scraper)

**Gov & regulatory:** [Federal Register Monitor](https://apify.com/brick_joey_yto/federal-register-monitor) · [Federal Court Monitor](https://apify.com/brick_joey_yto/federal-court-monitor) · [FDA Compliance Monitor](https://apify.com/brick_joey_yto/fda-compliance-monitor) · [Clinical Trials Monitor](https://apify.com/brick_joey_yto/clinical-trials-monitor) · [Lobbying Monitor](https://apify.com/brick_joey_yto/lobbying-monitor)

***

*Not affiliated with Discord. Requires a bot token you control for token modes — never share user account tokens. Respect Discord's Terms of Service.*

# Actor input Schema

## `mode` (type: `string`):

`invite` = anonymous server preview (name, member/online counts, description) · `widget` = live online member list for widget-enabled servers · `guild`/`channels`/`messages`/`members` = bot-token modes for servers your bot has joined.

## `discordToken` (type: `string`):

Required for guild/channels/messages/members modes. Create a free bot at discord.com/developers, enable Message Content + Server Members intents, and invite it to your server. Never uses user/selfbot tokens.

## `invites` (type: `array`):

Invite codes or URLs — e.g. \["midjourney", "https://discord.gg/minecraft"]. Returns server name, member counts, description, features.

## `guildIds` (type: `array`):

Discord server IDs (snowflakes). For widget mode the server must have its widget enabled.

## `channelIds` (type: `array`):

Channel snowflakes to pull message history from. Requires a bot token with read access.

## `before` (type: `string`):

Snowflake ID — fetch messages older than this (pagination resume).

## `maxResults` (type: `integer`):

Maximum rows to return (per source where applicable).

## `proxyConfiguration` (type: `object`):

Optional Apify proxy — Discord's public endpoints are permissive; enable for very large crawls.

## Actor input object example

```json
{
  "mode": "invite",
  "invites": [
    "midjourney"
  ],
  "maxResults": 100
}
```

# Actor output Schema

## `results` (type: `string`):

Dataset containing Discord rows

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "mode": "invite",
    "invites": [
        "midjourney"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("brick_joey_yto/discord-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "mode": "invite",
    "invites": ["midjourney"],
}

# Run the Actor and wait for it to finish
run = client.actor("brick_joey_yto/discord-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "mode": "invite",
  "invites": [
    "midjourney"
  ]
}' |
apify call brick_joey_yto/discord-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,brick_joey_yto/discord-scraper"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/CzZYl5ilKW0xG5cuS/builds/Cm8vFXqg5yX8yxsAC/openapi.json
