Skip to content

API Reference Overview

Squad exposes a REST API with automatic OpenAPI documentation. All responses are JSON. Real-time updates are delivered via Server-Sent Events (SSE).

Base URL

Your API base URL is provided during onboarding (e.g., https://yourorg.squadai.uk).

Interactive API documentation is available at:

  • Swagger UI: {base_url}/docs
  • ReDoc: {base_url}/redoc
  • OpenAPI JSON: {base_url}/openapi.json

Authentication

All endpoints require JWT authentication unless explicitly whitelisted. Squad integrates with your identity provider via OAuth2/OIDC.

Public Routes (No Auth Required)

EndpointPurpose
GET /healthLiveness check
GET /health/readyReadiness check
GET /auth/configOAuth bootstrap configuration
GET /docsSwagger UI
GET /redocReDoc documentation
GET /openapi.jsonOpenAPI specification

Authenticated Requests

Include the JWT token in the Authorization header:

Authorization: Bearer <your-jwt-token>

Tokens are obtained through your identity provider’s OAuth2 flow. The Squad frontend handles this automatically.

Quick Start

Create a session, send a question, and retrieve the event trace — three requests to go from zero to a complete answer.

1. Create a session

Terminal window
curl -X POST https://yourorg.squadai.uk/api/v1/chat \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{}'
{"session_id": "a1b2c3d4-5678-90ab-cdef-1234567890ab", "status": "created", "message": "Session created successfully"}

2. Send a message

Terminal window
curl -X POST https://yourorg.squadai.uk/api/v1/chat/a1b2c3d4-5678-90ab-cdef-1234567890ab/message \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"message": "What are the active fault schedules for reactor unit 3?"}'

The response is an SSE stream — events arrive as newline-delimited JSON until the final answer event.

3. Retrieve the event trace

Terminal window
curl https://yourorg.squadai.uk/api/v1/chat/a1b2c3d4-5678-90ab-cdef-1234567890ab/events \
-H "Authorization: Bearer $TOKEN"
{
"session_id": "a1b2c3d4-5678-90ab-cdef-1234567890ab",
"events": [
{"timestamp": "2026-03-17T10:30:00Z", "event": "step_started", "data": {"node": "classify"}},
{"timestamp": "2026-03-17T10:30:01Z", "event": "step_completed", "data": {"node": "classify", "query_type": "FACTUAL"}},
{"timestamp": "2026-03-17T10:30:02Z", "event": "tool_executed", "data": {"tool_name": "retriever", "success": true}},
{"timestamp": "2026-03-17T10:30:04Z", "event": "answer", "data": {"content": "There are 3 active fault schedules..."}}
]
}

See the Chat API for the full endpoint reference.

Endpoint Groups

Health

MethodEndpointDescription
GET/healthLiveness probe
GET/health/readyReadiness probe with component checks

Chat

MethodEndpointDescription
POST/api/v1/chatCreate a new chat session (rate limited: 60/min)
POST/api/v1/chat/{session_id}/messageSend a message (rate limited: 30/min)
GET/api/v1/chat/{session_id}/streamSSE event stream for real-time progress
GET/api/v1/chat/{session_id}/eventsHistorical event trace
GET/api/v1/chat/{session_id}/statusSession status
POST/api/v1/chat/{session_id}/disambiguateSend disambiguation response
POST/api/v1/chat/{session_id}/reviewSubmit review response
GET/api/v1/chat/{session_id}/historyGet session message history
GET/api/v1/chat/historyList all chat sessions

Query Curation

MethodEndpointDescription
GET/api/v1/aim/queries/statsQuery count breakdown by status
GET/api/v1/aim/queries/pendingList pending approval queries
GET/api/v1/aim/queries/approvedList approved templates
POST/api/v1/aim/queries/test-cypherExecute read-only query for testing
POST/api/v1/aim/queries/{id}/approveApprove a pending query
POST/api/v1/aim/queries/{id}/rejectReject a pending query
POST/api/v1/aim/queries/{id}/amendAmend and approve a query
DELETE/api/v1/aim/queries/{id}Delete a query

Review

MethodEndpointDescription
GET/api/v1/review/{session_id}/pendingGet pending reviews for a session
POST/api/v1/review/{session_id}/approveApprove a review item
POST/api/v1/review/{session_id}/rejectReject a review item
GET/api/v1/review/historyFull review history
GET/api/v1/review/{session_id}/memoriesSession memories

Workflows

MethodEndpointDescription
GET/api/v1/aim/workflowsList available workflows
POST/api/v1/aim/workflows/executeExecute a workflow
GET/api/v1/aim/workflows/{id}/stepsGet workflow steps and tools
GET/api/v1/aim/workflows/{id}/queriesRelated queries for a workflow
DELETE/api/v1/aim/workflows/{id}Revoke a workflow

Documents

MethodEndpointDescription
POST/api/v1/documents/uploadUpload files for ingestion
GET/api/v1/documents/List all documents
GET/api/v1/documents/ingestion-statusIngestion status
GET/api/v1/documents/graphKnowledge graph entries
GET/api/v1/documents/{doc_id}/previewPreview a document
GET/api/v1/documents/{doc_id}/downloadDownload original file
PATCH/api/v1/documents/{doc_id}/statusUpdate document status
POST/api/v1/documents/{doc_id}/approveApprove for ingestion
POST/api/v1/documents/{doc_id}/ingestTrigger ingestion
DELETE/api/v1/documents/{doc_id}Delete a document
POST/api/v1/documents/{doc_id}/linkCreate a relationship link
DELETE/api/v1/documents/{doc_id}/link/{rel_id}Remove a relationship link
POST/api/v1/documents/queue/enqueueAdd documents to the ingestion queue
POST/api/v1/documents/queue/pausePause the ingestion queue
POST/api/v1/documents/queue/resumeResume the ingestion queue
GET/api/v1/documents/queue/statusQueue status and progress
GET/api/v1/documents/queue/streamSSE stream for queue updates
DELETE/api/v1/documents/queue/{doc_id}Remove from the queue

Tools

MethodEndpointDescription
GET/api/v1/aim/toolsList registered tools
GET/api/v1/aim/tools/{tool_name}/workflowsWorkflows using a tool

Runs & Files

MethodEndpointDescription
GET/api/v1/runs/{run_id}/filesList files for a run
GET/api/v1/runs/{run_id}/preview/{path}Preview a run artifact
GET/api/v1/runs/{run_id}/download/{path}Download a run artifact

Error Codes

CodeMeaning
400Invalid input: check request body
401Unauthorized: missing or invalid JWT
403Forbidden: insufficient role or permissions
404Resource not found
429Rate limited (session creation: 60/min, messages: 30/min)
500Server error
503Service unavailable

Error responses return a JSON body with a detail field:

{"detail": "Rate limit exceeded. Try again in 42 seconds."}

SSE Event Format

The chat stream endpoint delivers events as newline-delimited JSON:

{"timestamp": "2026-03-17T10:30:00Z", "event": "step_started", "data": {"node": "classify", "run_id": "abc-123"}}
{"timestamp": "2026-03-17T10:30:01Z", "event": "step_completed", "data": {"node": "classify", "query_type": "FACTUAL"}}
{"timestamp": "2026-03-17T10:30:02Z", "event": "tool_executed", "data": {"tool_name": "retriever", "success": true}}