API Documentation
Base URL: https://finder.cloud-staging.needle.tools | 1 sources, 1 channels, 1 documents indexed.
Authentication
Endpoints are split into three access levels:
| Level | Auth Method | Endpoints |
|---|---|---|
| Public | None | GET /api/search, GET /api/documents, POST /api/ask |
| Bearer | Authorization: Bearer <token> | POST /api/v1/ask |
| Admin | Basic Auth or Authorization: Bearer <token> | All other /api/* endpoints (POST, PATCH, DELETE) |
| Dashboard | Basic Auth only | /dashboard |
Bearer Token Example
curl -X POST https://finder.cloud-staging.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://finder.cloud-staging.needle.tools/api/sources/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
https://finder.cloud-staging.needle.tools/api/search?q=YOUR_QUERY Full-text search across all messages and documents.
Example
curl "https://finder.cloud-staging.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
https://finder.cloud-staging.needle.tools/api/ask Ask a question using AI with RAG over indexed content. Used by the internal UI.
curl -X POST https://finder.cloud-staging.needle.tools/api/ask \
-H "Content-Type: application/json" \
-d '{"question": "What is the main topic discussed?"}'https://finder.cloud-staging.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..."
}
]
}Sources
https://finder.cloud-staging.needle.tools/api/sources List all configured sources. Requires Basic Auth or Bearer token.
https://finder.cloud-staging.needle.tools/api/sources Add a new source. Requires Basic Auth or Bearer token.
https://finder.cloud-staging.needle.tools/api/sources/:id Update a source. Requires Basic Auth or Bearer token.
https://finder.cloud-staging.needle.tools/api/sources/:id Delete a source and all its data. Requires Basic Auth or Bearer token.
Crawl
https://finder.cloud-staging.needle.tools/api/sources/:id/crawl Trigger a crawl for a source. Add ?full=true to recrawl all messages from the beginning. Requires Basic Auth or Bearer token.
Response
{"jobId": "...", "channels": 15, "messages": 1234}https://finder.cloud-staging.needle.tools/api/sources/:id/test Test connection to a source. Requires Basic Auth or Bearer token.
Documents
https://finder.cloud-staging.needle.tools/api/documents List all documents.
https://finder.cloud-staging.needle.tools/api/documents Upload a document (multipart form data). Requires Basic Auth or Bearer token.
SEO Pages
https://finder.cloud-staging.needle.tools/sources Browse all sources — channels, documents, and web content.
https://finder.cloud-staging.needle.tools/c/:slug View a channel's messages.
https://finder.cloud-staging.needle.tools/d/:slug View a document's content.
https://finder.cloud-staging.needle.tools/sitemap.xml Sitemap index.
Machine-Readable
https://finder.cloud-staging.needle.tools/llms.txt Plain text documentation for LLMs and AI agents.