Skip to main content

Base URL

http://localhost:8000
Start the API with langsight serve or docker compose up -d api.

Authentication

The API currently has no authentication in the open-source version. In production, place it behind a reverse proxy (nginx, Caddy) and restrict access to your network.

Interactive docs

Once the API is running:

Endpoints

Meta

MethodPathDescription
GET/api/statusAPI health check — returns {"status": "ok"}

Health

MethodPathDescription
GET/api/health/serversLatest health for all configured servers
GET/api/health/servers/{name}Latest health for one server
GET/api/health/servers/{name}/historyHealth history (newest first)
POST/api/health/checkTrigger on-demand health check

Security

MethodPathDescription
POST/api/security/scanRun security scan on all servers

Traces

MethodPathDescription
POST/api/traces/spansIngest ToolCallSpan JSON from the SDK
POST/api/traces/otlpIngest standard OTLP/JSON traces
GET/api/traces/spansQuery spans by server, tool, session, time range

Agent Sessions

MethodPathDescription
GET/api/agents/sessionsList agent sessions with aggregated cost, call count, and failure count
GET/api/agents/sessions/{session_id}Full span tree for one session, ordered by time, with parent_span_id hierarchy
Session object (returned by both endpoints):
{
  "session_id": "sess-f2a9b1",
  "agent_name": "orchestrator",
  "started_at": "2026-03-17T14:02:31Z",
  "ended_at": "2026-03-17T14:02:32Z",
  "duration_ms": 1482,
  "tool_call_count": 5,
  "failure_count": 1,
  "cost_usd": 0.023,
  "agents_involved": ["orchestrator", "research", "action"]
}

Quick test

# Health check
curl http://localhost:8000/api/status

# Latest server health
curl http://localhost:8000/api/health/servers | jq .

# Trigger health check
curl -X POST http://localhost:8000/api/health/check | jq .

# Send a span
curl -X POST http://localhost:8000/api/traces/spans \
  -H "Content-Type: application/json" \
  -d '[{"server_name":"pg","tool_name":"query","started_at":"2026-03-17T12:00:00Z","ended_at":"2026-03-17T12:00:00.042Z","latency_ms":42,"status":"success"}]'