Skip to content

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/api

Step 1: Get Your Server ID

First, you need your Discord server ID. You can find it by:

  1. Enable Developer Mode in Discord (User Settings → Advanced → Developer Mode)
  2. 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:

Terminal window
curl http://localhost:3000/api/servers/YOUR_SERVER_ID

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:

Terminal window
curl "http://localhost:3000/api/threads?serverId=YOUR_SERVER_ID&limit=5"

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:

Terminal window
curl http://localhost:3000/api/threads/111222333

Response:

{
"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:

Terminal window
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:

ParameterTypeDefaultDescription
serverIdstring-Filter by server
channelIdstring-Filter by channel
limitnumber20Results per page (1-100)
cursorstring-Pagination cursor

Filtering Threads

The threads endpoint has powerful filtering:

Terminal window
# Get resolved threads only
curl "http://localhost:3000/api/threads?serverId=123&status=resolved"
# Get threads by tag
curl "http://localhost:3000/api/threads?serverId=123&tag=bug"
# Sort by most active
curl "http://localhost:3000/api/threads?serverId=123&sort=recently_active"
# Get unanswered threads
curl "http://localhost:3000/api/threads?serverId=123&sort=unanswered"

Next Steps

You’ve made your first API calls! Now explore: