Skip to main content

OpenAPI Reference

The Control Plane API is documented using OpenAPI 3.1.0. The specification is auto-generated from FastAPI route definitions and kept in sync via CI.

Live Documentation​

The API serves interactive documentation at:

FormatURLDescription
Swagger UIhttps://api.<YOUR_DOMAIN>/docsInteractive API explorer
ReDochttps://api.<YOUR_DOMAIN>/redocRead-optimized documentation
OpenAPI JSONhttps://api.<YOUR_DOMAIN>/openapi.jsonRaw specification

Endpoint Categories​

The API organizes endpoints into the following groups:

CategoryPrefixEndpointsDescription
APIs/v1/tenants/{tenant_id}/apisCRUD + openapi + versionsTenant-scoped API lifecycle management
Tenants/v1/tenantsCRUD + membersTenant management
Subscriptions/v1/subscriptionsCRUD + approve/revokeSubscription lifecycle
Consumers/v1/consumersCRUD + keysConsumer management
Gateways/v1/gatewaysCRUD + healthGateway instance management
Deployments/v1/deploymentsList + promoteDeployment tracking
Environments/v1/environmentsListEnvironment management
Tools/v1/toolsCRUDMCP tool catalog
Webhooks/v1/tenants/{id}/webhooksCRUD + testEvent notifications
Service Accounts/v1/service-accountsCRUD + rotateM2M authentication
Health/healthGETPlatform health check
Metrics/metricsGETPrometheus metrics

Authentication​

All endpoints (except /health and /openapi.json) require a Bearer token:

Configure your environment

The examples below use environment variables. Set them for your STOA instance:

export STOA_API_URL="https://api.<YOUR_DOMAIN>"    # Control Plane API
export STOA_AUTH_URL="https://auth.<YOUR_DOMAIN>" # Keycloak OIDC provider
export STOA_GATEWAY_URL="https://mcp.<YOUR_DOMAIN>" # MCP Gateway endpoint

Replace <YOUR_DOMAIN> with the domain of your STOA instance.

# Get a token
TOKEN=$(curl -s -X POST "${STOA_AUTH_URL}/realms/stoa/protocol/openid-connect/token" \
-d "grant_type=password" \
-d "client_id=control-plane-api" \
-d "username=admin" \
-d "password=demo" \
| jq -r '.access_token')

# Use the token
curl -s "${STOA_API_URL}/v1/tenants" \
-H "Authorization: Bearer $TOKEN"

Common Response Codes​

CodeMeaningWhen
200SuccessGET, PUT, PATCH
201CreatedPOST (new resource)
204No ContentDELETE
400Bad RequestInvalid payload
401UnauthorizedMissing or invalid token
403ForbiddenInsufficient permissions
404Not FoundResource does not exist
409ConflictDuplicate resource
422UnprocessableValidation error (with details)
429Too Many RequestsRate limit exceeded

Error Format​

All errors use a single format: a JSON object with a detail field. See Control Plane API — Error Responses for the full description, including validation (422) and rate-limit (429) errors.

Pagination​

Paginated list endpoints (for example tenant APIs and subscriptions) take page and page_size query parameters:

curl "${STOA_API_URL}/v1/tenants/<tenant_id>/apis?page=1&page_size=20" \
-H "Authorization: Bearer $TOKEN"
ParameterDefaultMaxDescription
page1--Page number (1-based)
page_size20100Number of items per page

The response wraps the items in an envelope: {"items": [...], "total": 42, "page": 1, "page_size": 20} (subscription lists also return total_pages). Some list endpoints, such as GET /v1/tenants, return a plain JSON array and take no pagination parameters.

Downloading the Specification​

# Download the full OpenAPI spec
curl -s "${STOA_API_URL}/openapi.json" | jq '.' > openapi.json

# Count endpoints
cat openapi.json | jq '.paths | length'

The specification can be imported into tools like Postman, Insomnia, or any OpenAPI-compatible client.

Contract Testing​

The OpenAPI spec is validated in CI using snapshot tests:

# Generate and compare (in control-plane-api/)
pytest tests/test_openapi_contract.py -v

Any endpoint change that modifies the spec requires updating the snapshot.

Cookies and privacy

With your permission, we use cookies to measure visits and understand navigation to improve the site.

Learn more

Google Analytics measures visits and useful clicks. Microsoft Clarity provides masked interaction replays. No advertising use. Your choice is saved for six months. You can change or withdraw it at any time using the “Cookies” button.

Read the audience measurement details