Agent
Single-shot queries, multi-turn chat, and batch processing
The Agent endpoints let you ask questions over your project’s knowledge base. Three options depending on your use case: single query, chat, or batch.
POST /api/v2/agent/query
Single-shot Q&A. Ask one question, get one answer with source citations. Stateless — no conversation history is stored.
Authentication: Bearer token required
Request body:
Example request:
Example response 200 OK:
POST /api/v2/chat
Multi-turn conversation. Send a message history and get a contextual response. The AI understands follow-up questions based on prior messages.
Authentication: Bearer token required
Request body:
Choosing the agent (chat_type)
general/project— search your organization’s or project’s own documents. Always available.safety— the Safety Assistant, answering from the shared construction-safety corpus (regulations, PPE, site safety practice). Requires the Safety Assistant to be enabled for your organization; if it is not, the request returns403 AGENT_NOT_ENABLED.project_idis not needed — the safety corpus is organization-independent.- Omitted — the API classifies your message and routes it to the best agent among those enabled for your organization, falling back to
general(document search) when nothing else fits. Integrations that know which agent they want should setchat_typeexplicitly; end-user chat boxes can omit it.
Example — asking the Safety Assistant directly:
Example request:
Example response 200 OK (when stream: false):
Streaming: When stream: true, the response is delivered as Server-Sent Events (SSE). See Streaming & Async for implementation details.
POST /api/v2/agent/batches
Create a batch query. Submit multiple questions to be answered in the background. Ideal for compliance checklists, regulatory questionnaires, or bulk data extraction.
Authentication: Bearer token required
Request body:
Example request:
Example response 201 Created:
GET /api/v2/agent/batches
List all batch queries. Supports pagination and filtering by project.
Authentication: Bearer token required
Query parameters:
GET /api/v2/agent/batches/{id}
Get batch details with full results for each question.
Authentication: Bearer token required
Path parameters:
Example response 200 OK:
GET /api/v2/agent/batches/{id}/export
Download batch results as a CSV file. Opens in Excel, Google Sheets, etc.
Authentication: Bearer token required
Path parameters:
Response: 200 OK with Content-Type: text/csv
CSV columns: