<!-- Source: https://disdex.io/api -->

# disdex API

A free, open JSON API over the disdex index. Access every Discord server, user, and bot we've found. No key required.

## Quickstart

No signup, no key. Just call it:

```
curl https://disdex.io/api/v1/servers?q=minecraft&limit=3
```

Base URL: `https://disdex.io/api/v1` · CORS is open (`Access-Control-Allow-Origin: *`) so you can call it from the browser.

## Conventions

- **IDs are strings.** Discord snowflakes are 64-bit; we always serialise ids (and any id-typed field) as JSON strings so JavaScript doesn't silently corrupt them.
- **Versioned + stable.** Everything lives under `/api/v1`. Within v1 we only ever *add* fields and endpoints. Your client must ignore unknown keys. A breaking change would ship as `/api/v2`.
- **Paginated lists are enveloped:** `{ data, total, limit, offset, has_more }`. The activity and history endpoints are not paginated and return `{ server_id, data }` or `{ user_id, data }` (activity adds `range` and `interval`). Single resources return the object directly. `total` may be `null` when an exact count would be expensive. Always paginate off `has_more` (which is exact).
- **Errors** are `{ "error": { "code", "message" } }` with a matching HTTP status.
- **Timestamps** are RFC-3339 UTC strings.
- **Pagination caps:** `limit` ≤ 100, `offset` ≤ 10000. To reach deeper results, narrow with `q` rather than paging. It's faster for both of us.

## Limits

- **No rate limit, no key.** The API does not answer 429 today. Be reasonable: a few requests a second is plenty. If a limit is ever added it will be written here first, and it will answer 429 with a `Retry-After` header.
- **Page size:** `limit` is 1 to 100 (default 25) and `offset` 0 to 10000. The history endpoints take `limit` up to 200 (default 50).
- **Submitting:** at most 100 invites per `POST /api/v1/invites`.
- **Feed:** no limit on connections. One stream per client is enough.

## Errors

Every error is `{ "error": { "code", "message" } }` with the HTTP status below. `message` is for people and may be reworded; match on `code`.

- `invalid_request` (400): The body of POST /invites is not JSON or holds no valid invite. The code is invalid_request in each case, but the status is 415 when Content-Type is not application/json and 422 when the JSON has the wrong shape.
- `invalid_parameter` (400): A query parameter has the wrong type, such as limit=abc.
- `method_not_allowed` (405): The endpoint exists but not for that HTTP method.
- `too_many` (400): POST /invites had more than 100 invites.
- `invalid_code` (400): The invite code in the path is not a possible invite code.
- `invalid_id` (400): A server or user id in the path is not a numeric snowflake.
- `query_too_short` (400): q has fewer than 3 letters or digits and is not an invite code, invite URL or server ID.
- `invalid_language` (400): lang is neither a supported ISO 639-1 code nor unknown.
- `invalid_new_member_within` (400): new_member_within is not a number of days from 1 to 365.
- `invalid_name_length` (400): from_name_len or to_name_len is outside 2 to 32, or they are the wrong way round.
- `invalid_range` (400): range is not one of 24h, 7d, 30d, 90d, 1y, all.
- `invalid_interval` (400): interval is not hour or day.
- `offset_too_deep` (400): offset is below 0 or above 10000. Narrow the search with q instead.
- `invalid_key` (401): An API key was sent and it is invalid or revoked. Leave it out to call anonymously.
- `not_found` (404): No such server, user or endpoint, or the server or user is hidden from disdex.
- `internal_error` (500): Something failed on disdex's side. Safe to retry.

**What is not an error.** An unrecognised value for `sort`, `nsfw`, `vanity`, `tag_status` or `type` falls back to that parameter's default, and `limit` is clamped into its range: `limit=500` returns 100 and `limit=0` returns 1. The `limit` field of the response always says what was used. Parameters where a wrong value would mean wrong data are refused instead: `lang`, `range`, `interval`, `offset`, `new_member_within` and the name lengths.

## Endpoints

### GET /api/v1/servers

List and search servers. Every parameter is optional.

- `q` An invite code, a Discord invite URL, a server ID, or text with at least 3 letters or digits. Text matches the name and vanity URL as substrings, and every word as a prefix in the name, vanity, guild tag, profile traits and description. (Profile traits are searched but are not part of the response.)
- `lang` Detected language: an ISO 639-1 code such as en, es or de, or unknown for servers with no detected language. Default: every language.
- `tag` Guild tag, exact match, not case sensitive. Default: any.
- `tag_status` any (default), active or inactive. An inactive tag is leftover text Discord no longer displays; tag=BOSS&tag_status=active returns only servers wearing the tag now. It also works without tag: tag_status=active lists every server wearing any guild tag.
- `sort` relevance, members, online, boosts, newest or oldest. Default: relevance when q is text, otherwise members. Relevance puts servers named for the query first, then matches in traits and descriptions, words in order before scattered words, and bigger, more active servers first among similar matches.
- `nsfw` include (default), exclude or only.
- `vanity` any (default), has, no or only. only means a vanity URL exists but no live permanent regular invite does.
- `new_member_within` Days, 1 to 365: a scan saw the member count go up within that many days. Default: no such filter.
- `limit` 1 to 100. Default 25.
- `offset` 0 to 10000. Default 0.

In the response, language is null when no language was detected, tag is null when the server has no guild tag, and description, vanity_url_code, icon_url, banner_url, splash_url and invite_url are null when the server has none (invite_url is null when every known invite is dead). total is null when more than 1,000 servers match a text query. When no server matches every word of a query of three or more words, the results match all but one word and the envelope gains a top-level "partial_match": true next to has_more; the field is absent otherwise.

```
$ curl 'https://disdex.io/api/v1/servers?tag=BOSS&tag_status=active&limit=2'

{
  "data": [
    {
      "id": "123456789012345678",
      "name": "Boss Lounge",
      "description": "The BOSS community",
      "vanity_url_code": "bosslounge",
      "nsfw": false,
      "members": 871234,
      "online": 41200,
      "boosts": 64,
      "language": { "code": "en", "name": "English", "confidence": 0.99 },
      "features": ["COMMUNITY", "VANITY_URL", "GUILD_TAGS"],
      "tag": {
        "name": "BOSS",
        "badge": 17,
        "badge_url": "https://cdn.discordapp.com/clan-badges/123.../ab12.png",
        "active": true,
        "users": 3121
      },
      "icon_url": "https://cdn.discordapp.com/icons/123.../abc.png",
      "banner_url": null,
      "splash_url": null,
      "invite_url": "https://discord.gg/bosslounge",
      "first_seen_at": "2026-04-19T08:14:00Z",
      "last_scraped_at": "2026-06-13T10:55:00Z",
      "url": "https://disdex.io/server/123456789012345678"
    }
  ],
  "total": 74,
  "limit": 2,
  "offset": 0,
  "has_more": true
}
```

### GET /api/v1/servers/{id}

Fetch one server by its guild id (snowflake). The same object as in the list: language and tag are null when the server has none, never left out. An unknown or hidden id answers 404 not_found.

```
$ curl https://disdex.io/api/v1/servers/662267976984297473

{
  "id": "662267976984297473",
  "name": "Midjourney",
  "description": "The official server for Midjourney, a text-to-image AI ...",
  "vanity_url_code": "midjourney",
  "nsfw": false,
  "members": 18992312,
  "online": 784881,
  "boosts": 287,
  "language": { "code": "en", "name": "English", "confidence": 0.99 },
  "features": ["VERIFIED", "VANITY_URL", "ANIMATED_BANNER", "COMMUNITY"],
  "tag": null,
  "icon_url": "https://cdn.discordapp.com/icons/662267976984297473/a4f1c2....png",
  "banner_url": "https://cdn.discordapp.com/banners/662267976984297473/a_9b....gif",
  "splash_url": null,
  "invite_url": "https://discord.gg/midjourney",
  "first_seen_at": "2026-04-19T08:14:00Z",
  "last_scraped_at": "2026-06-13T18:25:00Z",
  "url": "https://disdex.io/server/662267976984297473"
}
```

### GET /api/v1/servers/{id}/activity

Member / online / boost count over time, bucket-averaged. Query: range (24h·7d·30d·90d·1y·all, default 30d), interval (hour·day; defaults to hour, or day for 1y/all; an interval you name is always used, so range=1y&interval=hour returns hourly points). History begins when we first indexed the server.

```
$ curl 'https://disdex.io/api/v1/servers/662267976984297473/activity?range=7d&interval=day'

{
  "server_id": "662267976984297473",
  "range": "7d",
  "interval": "day",
  "data": [
    { "ts": "2026-06-08T00:00:00Z", "members": 18970120, "online": 770233, "boosts": 287 },
    { "ts": "2026-06-09T00:00:00Z", "members": 18976540, "online": 781902, "boosts": 287 }
  ]
}
```

### GET /api/v1/servers/{id}/history

Change log for a server's name, description, vanity, and icon/banner/splash hashes, each as an old→new pair with a timestamp. The first-sighting snapshot is excluded, so every entry is a real change. Query: limit (≤ 200, default 50). Hash fields give raw Discord asset hashes.

```
$ curl https://disdex.io/api/v1/servers/662267976984297473/history

{
  "server_id": "662267976984297473",
  "data": [
    {
      "field": "name",
      "old": "Midjourney Beta",
      "new": "Midjourney",
      "changed_at": "2026-05-21T14:03:11Z"
    },
    {
      "field": "icon_hash",
      "old": "a4f1c2...",
      "new": "b7e0aa...",
      "changed_at": "2026-05-02T09:41:55Z"
    }
  ]
}
```

### GET /api/v1/users

List and search users: people seen creating invites, and bots. Every parameter is optional. In a user object, global_name, avatar_url and banner_url are null when the account has none.

- `q` Username prefix, at least 3 letters or digits.
- `type` user (default) or bot. One request returns one kind, never both.
- `from_name_len, to_name_len` Inclusive username length in characters, 2 to 32. Default: any length.
- `sort` invites (default), servers, username, newest or oldest.
- `limit` 1 to 100. Default 25.
- `offset` 0 to 10000. Default 0.

```
$ curl 'https://disdex.io/api/v1/users?type=bot&sort=servers&limit=1'

{
  "data": [
    {
      "id": "302050872383242240",
      "username": "disboard",
      "global_name": "DISBOARD",
      "is_bot": true,
      "avatar_url": "https://cdn.discordapp.com/avatars/302050872383242240/....png",
      "banner_url": null,
      "server_count": 4821,
      "invite_count": 5102,
      "first_seen_at": "2026-04-18T22:10:00Z",
      "last_seen_at": "2026-06-13T18:20:00Z",
      "url": "https://disdex.io/user/302050872383242240"
    }
  ],
  "total": 2037,
  "limit": 1,
  "offset": 0,
  "has_more": true
}
```

### GET /api/v1/users/{id}

Fetch one user (or bot) by its id. last_seen_at moves once per UTC day, at the first time we see the user that day.

```
$ curl https://disdex.io/api/v1/users/976920610124996670

{
  "id": "976920610124996670",
  "username": "bawar9",
  "global_name": "Cr Bawar",
  "is_bot": false,
  "avatar_url": "https://cdn.discordapp.com/avatars/976920610124996670/a2ee6d....png",
  "banner_url": null,
  "server_count": 3,
  "invite_count": 387,
  "first_seen_at": "2026-04-25T07:47:20Z",
  "last_seen_at": "2026-06-13T18:28:11Z",
  "url": "https://disdex.io/user/976920610124996670"
}
```

### GET /api/v1/users/{id}/history

Change log for a user's username, display (global) name, and avatar hash, each as an old→new pair with a timestamp. First-sighting snapshot excluded. Query: limit (≤ 200, default 50).

```
$ curl https://disdex.io/api/v1/users/976920610124996670/history

{
  "user_id": "976920610124996670",
  "data": [
    {
      "field": "global_name",
      "old": "bawar",
      "new": "Cr Bawar",
      "changed_at": "2026-06-01T11:20:04Z"
    },
    {
      "field": "avatar_hash",
      "old": "1f0b9c...",
      "new": "a2ee6d...",
      "changed_at": "2026-05-18T03:12:48Z"
    }
  ]
}
```

### GET /api/v1/stats

Index totals. games is the number of games disdex tracks on the site (disdex.io/games); the API has no games endpoint yet.

```
$ curl https://disdex.io/api/v1/stats

{
  "servers": 1872212,
  "users": 1797856,
  "bots": 2037,
  "games": 3038,
  "invites": 2743681,
  "updated_at": "2026-06-13T18:16:08Z"
}
```

### POST /api/v1/invites

Submit one or many invites for indexing. Body: {"invite": "<code|link>"} or {"invites": [...]} (at most 100; duplicates are merged). Each result has a status: queued (new to disdex; the crawler checks it shortly, so poll GET /api/v1/invites/{code}) or already_known (already in the index; server holds the full server object, as GET /api/v1/servers/{id} returns it, shortened in the example below). credited is true only when a valid API key was sent and the code was new. Entries that are not invite codes or links are skipped; if none is valid the request fails with 400 invalid_request, and more than 100 fails with 400 too_many.

```
$ curl -X POST https://disdex.io/api/v1/invites \
    -H 'Content-Type: application/json' \
    -d '{"invites": ["discord.gg/abcdef", "discord.gg/minecraft"]}'

{
  "data": [
    { "code": "abcdef", "status": "queued", "credited": false, "server": null },
    { "code": "minecraft", "status": "already_known", "credited": false,
      "server": { "id": "302094807046684672", "name": "MINECRAFT", "members": 4288964, ... } }
  ]
}
```

### GET /api/v1/invites/{code}

Resolve an invite code to its server, including DEAD codes. status is live · dead · pending · unknown. If we indexed the code while it was alive, the server is returned even after the invite dies, and server_invites lists the server's other invites (currently-live first) so you can still get in. alive comes from our recheck queue, so it reflects the invite's real current state. server is the full server object, the same as GET /api/v1/servers/{id} (shortened in the example below). For pending and unknown codes http_status and last_checked may be null, and for an unknown code server is null and server_invites is an empty list.

```
# A dead invite we indexed before it died still resolves its server,
# and hands you live alternatives:
$ curl https://disdex.io/api/v1/invites/67gZEhX89T

{
  "code": "67gZEhX89T",
  "status": "dead",
  "http_status": 404,
  "last_checked": "2026-06-26T03:40:11Z",
  "server": {
    "id": "1372866605138051082",
    "name": "Air Scripts",
    "url": "https://disdex.io/server/1372866605138051082"
  },
  "server_invites": [
    { "code": "abcdef", "alive": true,  "url": "https://discord.gg/abcdef",
      "expires_at": null, "last_checked": "2026-06-26T02:10:00Z" },
    { "code": "oldXYZ", "alive": false, "url": "https://discord.gg/oldXYZ",
      "expires_at": null, "last_checked": "2026-06-20T09:00:00Z" }
  ]
}
```

### GET /api/v1/feed

LIVE firehose (Server-Sent Events) of every scan the checker completes, the moment it happens. Each scan emits up to three events: server (guild snapshot with icon/banner/splash CDN URLs), user (the invite's creator, with avatar CDN URL plus new and avatar_changed flags, providing everything needed to archive profile pictures), and invite. Query: types (comma-separated servers, users, invites; the singular forms work too; default all; names it does not know are ignored, and if none is known you get all three). The SSE event name and the JSON type field are always singular: server, user or invite. One example of each is below; these are the complete sets of fields, and the feed's server and user objects carry raw hashes that the REST objects do not. Semantics: best-effort live data with NO replay. If you disconnect you miss what happened while you were away, and the stream closes at least every 45 minutes (scheduled process restart), so loop your reconnect (EventSource does this automatically) and backfill via the REST endpoints. A lagged event (event: lagged, data: {"type":"lagged","missed":120}) means your client read too slowly and that many events were skipped. There is no limit on connections; one stream per client is enough, filtered with types. Append ?size=4096 to any cdn.discordapp.com URL for the largest image; animated assets have a_-prefixed hashes and .gif URLs.

```
$ curl -N https://disdex.io/api/v1/feed

event: user
data: {"type":"user","new":false,"avatar_changed":true,"observed_at":"2026-07-12T10:02:11Z","user":{"id":"163770619059503104","username":"nelly","global_name":"Nelly","is_bot":false,"avatar_hash":"a_9316e211...","avatar_url":"https://cdn.discordapp.com/avatars/163770619059503104/a_9316e211....gif","banner_hash":null,"banner_url":null,"accent_color":null}}

event: server
data: {"type":"server","new":false,"observed_at":"2026-07-12T10:02:11Z","invite_code":"bosslounge","server":{"id":"123456789012345678","name":"Boss Lounge","description":null,"vanity_url_code":"bosslounge","nsfw":false,"members":871234,"online":41200,"boosts":64,"icon_hash":"ab12...","icon_url":"https://cdn.discordapp.com/icons/123.../ab12....png","banner_hash":null,"banner_url":null,"splash_hash":null,"splash_url":null}}

event: invite
data: {"type":"invite","new":false,"observed_at":"2026-07-12T10:02:11Z","invite":{"code":"bosslounge","url":"https://discord.gg/bosslounge","guild_id":"123456789012345678","inviter_id":"163770619059503104","channel_name":"welcome","expires_at":null}}

// JavaScript: archive every profile picture as it's discovered:
const es = new EventSource('https://disdex.io/api/v1/feed?types=users');
es.addEventListener('user', e => {
  const { user, new: isNew, avatar_changed } = JSON.parse(e.data);
  if (user.avatar_url && (isNew || avatar_changed || !seen.has(user.avatar_hash)))
    archive(user.id, user.avatar_url + '?size=4096');
});
```

## API keys (optional)

The whole API works without a key. A key does one thing today: it **credits the invites you submit to your disdex profile**, so they count on the [submitter leaderboard](https://disdex.io/leaderboard). (It's also where per-account reputation and future paid tiers such as bulk export will hook in.)

Send it on `POST /api/v1/invites`:

```
curl -X POST https://disdex.io/api/v1/invites \
    -H 'Authorization: Bearer dsdx_your_key_here' \
    -H 'Content-Type: application/json' \
    -d '{"invites": ["discord.gg/abc", "discord.gg/def"]}'
```

[Log in](https://disdex.io/auth/login) to create a key.
