First API Call
Let’s make your first API call and fetch some data from your synced Discord forum.
Base URL
All API endpoints are prefixed with /api:
http://localhost:3000/apiStep 1: Get Your Server ID
First, you need your Discord server ID. You can find it by:
- Enable Developer Mode in Discord (User Settings → Advanced → Developer Mode)
- Right-click your server name → Copy Server ID
Or check your console logs when the bot starts—it lists connected server IDs.
Step 2: Fetch Server Info
Let’s start with a simple request to get server information:
curl http://localhost:3000/api/servers/YOUR_SERVER_IDconst response = await fetch('http://localhost:3000/api/servers/YOUR_SERVER_ID');const server = await response.json();console.log(server);import requests
response = requests.get('http://localhost:3000/api/servers/YOUR_SERVER_ID')server = response.json()print(server)Response:
{ "id": "123456789", "name": "My Awesome Server", "icon": "abc123def456", "description": "A place for developers to hang out", "memberCount": 1500}Step 3: List Threads
Now let’s fetch threads from your forum channels:
curl "http://localhost:3000/api/threads?serverId=YOUR_SERVER_ID&limit=5"const response = await fetch( 'http://localhost:3000/api/threads?serverId=YOUR_SERVER_ID&limit=5');const data = await response.json();console.log(data.threads);Response:
{ "threads": [ { "id": "111222333", "title": "How do I implement OAuth?", "slug": "how-do-i-implement-oauth", "preview": "I'm trying to add Discord OAuth to my app...", "status": "resolved", "messageCount": 8, "author": { "id": "user123", "username": "curious_dev", "avatar": "avatar123" }, "tags": ["oauth", "solved"], "createdAt": "2024-01-15T10:30:00.000Z", "lastActivityAt": "2024-01-15T14:20:00.000Z" } ], "nextCursor": "abc123", "hasMore": true}Step 4: Get Thread Details
Fetch a specific thread with all its messages:
curl http://localhost:3000/api/threads/111222333Response:
{ "id": "111222333", "title": "How do I implement OAuth?", "slug": "how-do-i-implement-oauth", "status": "resolved", "author": { "id": "user123", "username": "curious_dev", "avatar": "avatar123" }, "tags": ["oauth", "solved"], "messages": [ { "id": "msg001", "content": "I'm trying to add Discord OAuth to my app but getting a redirect error.", "contentHtml": "<p>I'm trying to add Discord OAuth to my app but getting a redirect error.</p>", "author": { "id": "user123", "username": "curious_dev" }, "reactions": [ { "emoji": "eyes", "count": 2 } ], "createdAt": "2024-01-15T10:30:00.000Z" }, { "id": "msg002", "content": "Make sure your redirect URL matches exactly in the Developer Portal.", "contentHtml": "<p>Make sure your redirect URL matches exactly in the Developer Portal.</p>", "author": { "id": "user456", "username": "helpful_mod" }, "reactions": [ { "emoji": "check", "count": 3 } ], "createdAt": "2024-01-15T10:45:00.000Z" } ], "messageCount": 8, "createdAt": "2024-01-15T10:30:00.000Z"}Step 5: Search Content
Search across all threads and messages:
curl "http://localhost:3000/api/search?q=OAuth&serverId=YOUR_SERVER_ID"Response:
{ "query": "OAuth", "results": { "threads": [ { "id": "111222333", "title": "How do I implement OAuth?", "preview": "I'm trying to add Discord OAuth...", "score": 0.95 } ], "messages": [ { "id": "msg002", "content": "Make sure your redirect URL matches exactly...", "threadId": "111222333", "threadTitle": "How do I implement OAuth?", "score": 0.72 } ] }, "total": 5}Common Query Parameters
Most list endpoints support these parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
serverId | string | - | Filter by server |
channelId | string | - | Filter by channel |
limit | number | 20 | Results per page (1-100) |
cursor | string | - | Pagination cursor |
Filtering Threads
The threads endpoint has powerful filtering:
# Get resolved threads onlycurl "http://localhost:3000/api/threads?serverId=123&status=resolved"
# Get threads by tagcurl "http://localhost:3000/api/threads?serverId=123&tag=bug"
# Sort by most activecurl "http://localhost:3000/api/threads?serverId=123&sort=recently_active"
# Get unanswered threadscurl "http://localhost:3000/api/threads?serverId=123&sort=unanswered"Next Steps
You’ve made your first API calls! Now explore:
- API Overview - Full API documentation
- Use Cases - Build real applications
- Deployment - Deploy to production