API Reference
Integrate BeforeQuery into your product with the Search and Chat APIs. Programmatically manage projects, trigger syncs, and retrieve analytics.
Authentication
The BeforeQuery API uses Bearer token authentication. Include your API key in the Authorization header:
Authorization: Bearer bq_live_your_api_key_hereGetting Your API Key
- Log in to your BeforeQuery dashboard
- Navigate to Settings → API Keys
- Click "Create New Key" and choose a name
- Copy the key and store it securely — it is shown once
Base URL
https://api.beforequery.com/v1All API requests use this base URL. Responses are JSON. The Chat API supports server-sent events (SSE) streaming — add Accept: text/event-stream to enable.
Chat API Example
{
"project_id": "proj_abc123",
"question": "How do I rate-limit the API?",
"session_id": "sess_xyz",
"stream": false
}{
"answer": "Use the X-RateLimit-Limit and
X-RateLimit-Remaining headers to track
your quota...",
"citations": [
{
"title": "Rate Limiting",
"url": "https://docs.example.com/rate",
"excerpt": "All API calls are subject..."
}
],
"confidence": 0.94,
"session_id": "sess_xyz"
}Search API Example
{
"project_id": "proj_abc123",
"query": "authentication API key",
"limit": 5,
"mode": "hybrid"
}{
"results": [
{
"title": "Authentication",
"url": "https://docs.example.com/auth",
"excerpt": "Pass your API key as...",
"score": 0.97
}
],
"total": 5
}All Endpoints
/v1/chat/v1/search/v1/projects/v1/projects/v1/projects/:id/v1/projects/:id/sync/v1/projects/:id/analytics/v1/sources/v1/sources/:id/mcp/projects/:projectIdMCP Server
Every BeforeQuery project exposes a Model Context Protocol (MCP) server. Any MCP-aware AI application — IDEs like Cursor and Windsurf, Claude Desktop, or your own LLM — can query your knowledge base as structured tools.
POST https://api.beforequery.com/mcp/projects/:projectIdX-Client-Key: bq_pk_your_client_key_hereThe MCP server is available on Pro and Enterprise plans. Activate it in your project settings. Once active, use any MCP client to list available tools and issue queries against your indexed knowledge.
@beforequery/agents SDK
The open-source @beforequery/agents TypeScript package provides typed primitives for building agent workflows that call the BeforeQuery API, MCP servers, and external A2A agents.
See the Agent Platform page for full graph definition examples including multi-agent graphs, human-approval nodes, and MCP tool integration.
Rate Limits
Free Plan
60
API calls per minute
Pro Plan
600
API calls per minute
Enterprise
Custom
contact sales