Skip to main content
Answer Overflow provides REST API endpoints for programmatic access to messages, webhooks, and integrations.

Base URL

https://www.answeroverflow.com/api
All API endpoints are prefixed with /api.

Authentication

API endpoints use API key authentication via header:
Authorization: Bearer YOUR_API_KEY
# or
x-api-key: YOUR_API_KEY

Generate API Key

  1. Go to Answer Overflow Dashboard
  2. Navigate to Settings
  3. Click “Generate API Key”
  4. Copy and securely store your key
API keys grant full access to your server data. Keep them secure and never commit them to version control.

OpenAPI Specification

Answer Overflow provides OpenAPI 3.0 specifications for all endpoints.

Get OpenAPI Spec

GET /api/openapi/json
Returns the full OpenAPI 3.1 specification.

Get Mintlify-Compatible Spec

GET /api/openapi-mintlify
Returns OpenAPI 3.0 specification compatible with Mintlify’s API playground. Response Example:
{
  "openapi": "3.0.0",
  "info": {
    "title": "AnswerOverflow API",
    "version": "1.0.0",
    "description": "API for interacting with AnswerOverflow programmatically."
  },
  "servers": [
    {
      "url": "https://www.answeroverflow.com/",
      "description": "Production"
    }
  ],
  "components": {
    "securitySchemes": {
      "apiKey": {
        "type": "apiKey",
        "in": "header",
        "name": "x-api-key"
      }
    }
  }
}

Message Endpoints

Update Message Solution

Mark or unmark a message as a solution.
POST /api/v1/messages/:id
id
string
required
Discord message ID (snowflake as string)
Headers:
x-api-key
string
required
Your Answer Overflow API key
Body:
solutionId
string | null
required
Discord message ID to mark as solution, or null to unmark the current solution
Request Example:
curl -X POST https://www.answeroverflow.com/api/v1/messages/1234567890 \
  -H "x-api-key: your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "solutionId": "9876543210"
  }'
Response (200 OK):
success
boolean
Always true on success
{
  "success": true
}
Error Responses:
error
string
Error message describing what went wrong
400 Bad Request - Invalid message ID format or missing fields
{
  "error": "Invalid message ID format"
}
401 Unauthorized - Missing or invalid API key
{
  "error": "Unauthorized - x-api-key header required"
}
403 Forbidden - API key doesn’t have access to this server
{
  "error": "API key does not have access to this server"
}
404 Not Found - Message not found in database
{
  "error": "Message not found"
}
500 Internal Server Error - Server error
{
  "error": "Internal server error"
}
Implementation: /apps/main-site/src/app/(main-site)/api/[[...slugs]]/route.ts:122

Webhook Endpoints

Convex Webhooks

Receive webhooks from Convex database operations.
POST /api/v1/webhooks/convex
Internal Use Only - This endpoint is called by Convex and requires webhook signature verification. Headers:
webhook-signature
string
required
Convex webhook signature for verification
Body: Convex webhook payload varies by event type. Events:
  • Database document created
  • Database document updated
  • Database document deleted
  • Scheduled function completed
Implementation: /apps/main-site/src/app/handlers/convex-webhooks.ts

GitHub Webhooks

Receive webhooks from GitHub for issue/PR synchronization.
POST /api/v1/webhooks/github
Internal Use Only - This endpoint is called by GitHub and requires webhook signature verification. Headers:
x-hub-signature-256
string
required
GitHub webhook signature (HMAC SHA256)
x-github-event
string
required
GitHub event type (e.g., “issues”, “pull_request”)
Body: GitHub webhook payload varies by event type. Events:
  • issues.opened - New issue created
  • issues.closed - Issue closed
  • issues.reopened - Issue reopened
  • issue_comment.created - Comment added to issue
  • pull_request.opened - PR opened
  • pull_request.merged - PR merged
What It Does:
  • Syncs Discord threads with GitHub issues
  • Posts updates to Discord when issues are updated
  • Tracks issue status in Answer Overflow
Implementation: /apps/main-site/src/app/handlers/github-webhooks.ts

Authentication Endpoints

Better Auth

Answer Overflow uses Better Auth for authentication.
ALL /api/auth/*
Available Routes:
  • GET /api/auth/signin - Sign in page
  • POST /api/auth/signin/discord - Discord OAuth sign in
  • POST /api/auth/signin/github - GitHub OAuth sign in
  • POST /api/auth/signout - Sign out
  • GET /api/auth/session - Get current session
  • POST /api/auth/callback/discord - Discord OAuth callback
  • POST /api/auth/callback/github - GitHub OAuth callback
Session Cookie: Authentication state is maintained via HTTP-only secure cookies:
  • Cookie name: auth_session
  • HttpOnly: true
  • Secure: true (production)
  • SameSite: Lax
Implementation: Uses Better Auth library with custom Convex adapter

Content Endpoints

Message Markdown Export

Get a message rendered as Markdown.
GET /m/:messageId/markdown
messageId
string
required
Discord message ID
Response (200 OK):
# Question Title

**Author:** @username  
**Posted:** January 15, 2024 at 10:30 AM

## Question

How do I configure webhooks in Discord?

## Solution

**Author:** @helper  
**Posted:** January 15, 2024 at 10:45 AM

You can configure webhooks by...
Content-Type: text/markdown Implementation: /apps/main-site/src/app/(main-site)/m/[messageId]/markdown/route.ts

User Comments

Get all comments/messages from a specific user.
GET /u/:userId/comments
userId
string
required
Discord user ID
Query Parameters:
page
number
Page number for pagination (default: 1)
limit
number
Items per page (default: 50, max: 100)
Response (200 OK):
{
  "comments": [
    {
      "messageId": "1234567890",
      "content": "Here's how to solve that...",
      "threadId": "9876543210",
      "threadTitle": "Help with webhooks",
      "serverId": "111222333",
      "serverName": "My Server",
      "channelId": "444555666",
      "channelName": "help",
      "timestamp": "2024-01-15T10:45:00Z",
      "isSolution": true
    }
  ],
  "pagination": {
    "page": 1,
    "limit": 50,
    "total": 127,
    "hasMore": true
  }
}
Implementation: /apps/main-site/src/app/(main-site)/u/[userId]/comments/route.ts

Sitemap & Robots

Dynamic Sitemap

Get XML sitemap for a specific server domain.
GET /sitemap.xml
GET /:domain/sitemap.xml
Response (200 OK):
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <url>
    <loc>https://help.example.com/m/1234567890</loc>
    <lastmod>2024-01-15</lastmod>
    <changefreq>weekly</changefreq>
    <priority>0.8</priority>
  </url>
  <!-- More URLs -->
</urlset>
Content-Type: application/xml Implementation: /apps/main-site/src/app/[domain]/(content)/sitemap.xml/route.ts

Robots.txt

Get robots.txt for SEO crawlers.
GET /robots.txt  
GET /:domain/robots.txt
Response (200 OK):
User-agent: *
Allow: /
Disallow: /admin
Disallow: /api
Sitemap: https://help.example.com/sitemap.xml
Content-Type: text/plain Implementation: /apps/main-site/src/app/[domain]/(content)/robots.txt/route.ts

MCP (Model Context Protocol)

MCP Server Endpoint

Model Context Protocol endpoint for AI tools integration.
POST /mcp
GET /mcp
Purpose: Allows AI models and tools to query Answer Overflow’s knowledge base. Request:
{
  "method": "tools/call",
  "params": {
    "name": "search",
    "arguments": {
      "query": "how to setup webhooks",
      "server": "My Server"
    }
  }
}
Response:
{
  "content": [
    {
      "type": "text",
      "text": "Based on the community discussions..."
    },
    {
      "type": "resource",
      "resource": {
        "uri": "answeroverflow://message/1234567890",
        "name": "How to Setup Webhooks"
      }
    }
  ]
}
Available Tools:
search_answeroverflow
tool
Search for answers on Answer Overflow - a searchable archive of Discord help channels.Parameters:
  • query (string, required) - The search query (error messages, function names, concepts)
  • serverId (string, optional) - Filter to specific Discord server
  • limit (number, optional) - Max results (1-25, default 10)
search_servers
tool
Search for Discord servers indexed on Answer Overflow by name.Parameters:
  • query (string, optional) - Filter servers by name
  • limit (number, optional) - Max servers (1-100, default 25)
get_thread_messages
tool
Get the full conversation of a thread including all messages.Parameters:
  • threadId (string, required) - The thread identifier
find_similar_threads
tool
Find similar threads using semantic search.Parameters:
  • query (string, required) - The search query
  • limit (number, optional) - Max results
Implementation: /apps/main-site/src/app/(main-site)/mcp/route.ts:36

Rate Limiting

API endpoints implement rate limiting to prevent abuse:

Limits

  • Authenticated Requests: 100 requests per minute
  • Public Requests: 20 requests per minute
  • Webhook Endpoints: No rate limit (signature verified)

Rate Limit Headers

Responses include rate limit information:
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 95
X-RateLimit-Reset: 1642345678

Rate Limit Exceeded

429 Too Many Requests:
{
  "error": "Rate limit exceeded",
  "retryAfter": 60
}

Error Handling

All endpoints follow consistent error response format:
{
  "error": "Error message",
  "code": "ERROR_CODE",
  "details": {
    "field": "Additional context"
  }
}

Common Error Codes

  • UNAUTHORIZED - Missing or invalid authentication
  • FORBIDDEN - Insufficient permissions
  • NOT_FOUND - Resource not found
  • INVALID_INPUT - Invalid request parameters
  • RATE_LIMITED - Rate limit exceeded
  • INTERNAL_ERROR - Server error

SDK & Client Libraries

TypeScript/JavaScript

npm install @answeroverflow/api
import { AnswerOverflow } from '@answeroverflow/api';

const client = new AnswerOverflow({
  apiKey: process.env.ANSWER_OVERFLOW_API_KEY
});

// Mark a solution
await client.messages.markSolution({
  questionId: '1234567890',
  solutionId: '9876543210'
});

// Search messages
const results = await client.search.messages({
  query: 'webhooks',
  serverId: '111222333'
});

Python

pip install answeroverflow
from answeroverflow import AnswerOverflow

client = AnswerOverflow(api_key=os.environ['ANSWER_OVERFLOW_API_KEY'])

# Mark a solution
client.messages.mark_solution(
    question_id='1234567890',
    solution_id='9876543210'
)

# Search messages
results = client.search.messages(
    query='webhooks',
    server_id='111222333'
)

Webhooks (Outgoing)

Configure Answer Overflow to send webhooks to your endpoints when events occur.

Setup

  1. Go to Dashboard Settings
  2. Navigate to “Webhooks”
  3. Add your webhook URL
  4. Select events to receive

Events

  • message.created - New message indexed
  • message.updated - Message content changed
  • solution.marked - Solution marked on thread
  • solution.unmarked - Solution removed from thread
  • thread.created - New thread indexed
  • thread.archived - Thread archived

Webhook Payload

{
  "event": "solution.marked",
  "timestamp": "2024-01-15T10:45:00Z",
  "data": {
    "questionId": "1234567890",
    "solutionId": "9876543210",
    "threadId": "1111222333",
    "serverId": "4444555666",
    "markedBy": "7777888999"
  }
}

Webhook Signature

Verify webhooks using HMAC signature:
import crypto from 'crypto';

function verifyWebhook(payload: string, signature: string, secret: string) {
  const expectedSignature = crypto
    .createHmac('sha256', secret)
    .update(payload)
    .digest('hex');
  
  return crypto.timingSafeEqual(
    Buffer.from(signature),
    Buffer.from(expectedSignature)
  );
}