Skip to main content

API reference

The Spanway gateway publishes an OpenAPI 3 document at /openapi.json and an interactive explorer at / on every running instance. This reference is generated from a snapshot of that document taken from a gateway running with an enterprise license, so it includes the enterprise routes for custom roles, access requests, compliance and billing. The snapshot is bundled with the site as openapi.json, which you can load into any OpenAPI tool or client generator.

Endpoints are grouped by the tag the gateway assigns to them. Each tag page lists its endpoints with a summary, the description from the gateway source, path and query parameters, the request body fields, an example curl request, and the documented responses.

Authentication​

Every request except the public and health endpoints needs an Authorization: Bearer <key> header. Use the master key for administrative routes, or a virtual key created with POST /key/generate. The examples read the key from the SPANWAY_API_KEY environment variable. The gateway also accepts the key in the x-spanway-api-key header and, for Anthropic-style clients, in x-api-key. Routes a key cannot reach return 401 or 403 with an error body. Routes open to anonymous callers carry an empty security list in the document, and their examples send no key.

Base URL​

All examples assume the gateway listens on http://localhost:4000. OpenAI-compatible routes are served both with and without the /v1 prefix, so /v1/chat/completions and /chat/completions are the same endpoint. If you serve the gateway under a sub-path with SERVER_ROOT_PATH, prepend that path to every route.

Tags​

TagEndpoints
[beta] Agents1
[beta] MCP1
A2a5
A2a registration1
Access groups10
Access requests6
Adaptive router1
Agent Management5
Agent tracing17
Agents18
Alerting1
Alerts8
Analytics12
Anthropic passthrough3
Anthropic skills4
Assistants16
Audio4
Audit logging5
Auto router6
Batch12
Billing17
Budget & Spend Tracking29
Budget management7
Cache Settings4
Caching4
Chat/completions4
Claude code marketplace8
Cloud25
Cloudzero6
Code graph15
Completions4
Compliance2
Compliance controls16
Config overrides8
Config.yaml3
Containers18
Coordination Redis Settings3
Cost Optimization1
Cost Tracking8
Credential management13
Custom agents9
Customer Management13
Decisions4
Email management3
Embeddings4
Environments9
Evals102
Experimental1
Fallback Management3
Files15
Fine-tuning16
Gemini agents5
Google genai endpoints14
Guardrails25
Health19
Human approvals11
Images8
Inspect1
Internal User management11
Invite Links4
Jwt mappings5
Key management17
Langfuse passthrough5
Lens11
Llm passthrough121
Llm utils4
Logging Callbacks2
Mcp4
Mcp byok oauth9
Mcp discoverable15
Mcp management41
Mcp rest4
Memory management5
Model insights2
Model management36
Moderations2
Ocr2
OpenAI Pass-through5
Organization management16
Organization sso13
Other endpoints33
Pass-through management5
Plugins2
Policies10
Policy engine20
Project management5
Prompts23
Public22
Rag4
Realtime6
Rerank3
Responses24
Role management8
Router Settings2
Routing presets10
Run ledger2
Rust control plane1
Sanctions10
Scim20
Search6
Search tools7
Server tools1
Settings6
Skill scanning1
SSO Settings6
Status page7
Tag management20
Team management36
Tools9
UI Session8
UI Settings5
UI Theme Settings4
Usage ai1
Vantage6
Vector store management6
Vector stores28
Videos18
WebSocket6
Workflow definitions13
Workflow management8
Workflow runner16
Workflow templates7
Workflow triggers15
Workload identity1