API Documentation

Base URL: https://seochat.labs.needle.tools | 1 platforms, 150 channels, 1 documents indexed.

Authentication

Endpoints are split into three access levels:

LevelAuth MethodEndpoints
PublicNoneGET /api/search, GET /api/documents, POST /api/ask
BearerAuthorization: Bearer <token>POST /api/v1/ask
AdminBasic Auth or Authorization: Bearer <token>All other /api/* endpoints (POST, PATCH, DELETE)
DashboardBasic Auth only/dashboard

Bearer Token Example

curl -X POST https://seochat.labs.needle.tools/api/v1/ask \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_SECRET_KEY" \
  -d '{"question": "How do I get started?"}'

Admin Bearer Token Example

curl -X POST https://seochat.labs.needle.tools/api/platforms/PLATFORM_ID/crawl \
  -H "Authorization: Bearer YOUR_API_SECRET_KEY"

Set API_SECRET_KEY env var to enable bearer token authentication. All POST, PATCH, and DELETE endpoints accept either Basic Auth or Authorization: Bearer <token>.

Search

GET
Public https://seochat.labs.needle.tools/api/search?q=YOUR_QUERY

Full-text search across all messages and documents.

Example

curl "https://seochat.labs.needle.tools/api/search?q=help"

Response

{
  "messages": [
    {
      "id": "...",
      "content": "message text",
      "timestamp": "2024-01-01T00:00:00Z",
      "username": "user",
      "channelName": "general",
      "channelSlug": "general",
      "platformName": "My Server",
      "platformType": "discord"
    }
  ],
  "documents": [
    {
      "id": "...",
      "title": "Doc Title",
      "slug": "doc-title",
      "content": "full content..."
    }
  ]
}

Ask AI

POST
Public https://seochat.labs.needle.tools/api/ask

Ask a question using AI with RAG over indexed content. Used by the internal UI.

curl -X POST https://seochat.labs.needle.tools/api/ask \
  -H "Content-Type: application/json" \
  -d '{"question": "What is the main topic discussed?"}'
POST
API Key https://seochat.labs.needle.tools/api/v1/ask

Public AI Ask API for external integrations. Requires Authorization: Bearer <token> header matching API_SECRET_KEY env var.

Response

{
  "answer": "Based on the indexed content...",
  "sources": [
    {
      "type": "message",
      "score": 0.89,
      "metadata": "user in #general (Discord) at 2024-01-01",
      "preview": "message preview..."
    }
  ]
}

Platforms

GET
Admin https://seochat.labs.needle.tools/api/platforms

List all configured platforms. Requires Basic Auth or Bearer token.

POST
Admin https://seochat.labs.needle.tools/api/platforms

Add a new platform. Requires Basic Auth or Bearer token.

PATCH
Admin https://seochat.labs.needle.tools/api/platforms/:id

Update a platform. Requires Basic Auth or Bearer token.

DELETE
Admin https://seochat.labs.needle.tools/api/platforms/:id

Delete a platform and all its data. Requires Basic Auth or Bearer token.

Crawl

POST
Admin https://seochat.labs.needle.tools/api/platforms/:id/crawl

Trigger a crawl for a platform. Add ?full=true to recrawl all messages from the beginning. Requires Basic Auth or Bearer token.

Response

{"jobId": "...", "channels": 15, "messages": 1234}
POST
Admin https://seochat.labs.needle.tools/api/platforms/:id/test

Test connection to a platform. Requires Basic Auth or Bearer token.

Documents

GET
Public https://seochat.labs.needle.tools/api/documents

List all documents.

POST
Admin https://seochat.labs.needle.tools/api/documents

Upload a document (multipart form data). Requires Basic Auth or Bearer token.

SEO Pages

https://seochat.labs.needle.tools/channels

Browse all channels grouped by platform.

https://seochat.labs.needle.tools/c/:slug

View a channel's messages.

https://seochat.labs.needle.tools/d/:slug

View a document's content.

https://seochat.labs.needle.tools/sitemap.xml

Sitemap index.

Machine-Readable

https://seochat.labs.needle.tools/llms.txt

Plain text documentation for LLMs and AI agents.