Skip to main content

stoa.yaml Reference

stoa.yaml is the declarative API configuration format for STOA Platform. It is used as the input for:

  • stoactl deploy ./stoa.yaml β€” CLI-driven deployment
  • Console UI β€” Import / Export via the API form
  • MCP Copilot β€” AI-generated and AI-validated deployments

See ADR-045 for the full design rationale.


Minimal Example​

name: customer-api
version: 1.2.0

Deploys with default settings: rate limit 1000 req/min, no auth, no endpoint filtering.


Full Example​

name: customer-api
version: 2.0.0
tags:
- payments
- crm

endpoints:
- path: /customers
method: GET
description: List all customers
tags: [read]
- path: /customers/{id}
method: GET
description: Get customer by ID
- path: /customers
method: POST
description: Create a new customer
tags: [write]

rate_limit:
requests_per_minute: 1000
burst: 50

auth:
type: oauth2
issuer: ${STOA_AUTH_URL}/realms/acme
required: true

Field Reference​

Top-level fields​

FieldTypeRequiredDefaultDescription
namestringYesβ€”API unique identifier. Max 255 characters. Used as the API name in the Control Plane.
versionstringNo1.0.0Semantic version (e.g. 1.2.0, 2.0.0-beta). Must match MAJOR.MINOR.PATCH pattern.
tagsstring[]No[]Optional tags attached to the API for filtering and grouping.
endpointsobject[]No[]Endpoint definitions. If empty, all traffic passes through without endpoint-level routing.
rate_limitobjectNonullRate limiting policy. If absent, no rate limit is applied.
authobjectNonullAuthentication policy. If absent, no authentication is required.

endpoints[]​

Each entry defines an endpoint that should be exposed through the gateway.

FieldTypeRequiredDefaultDescription
pathstringYesβ€”URL path (e.g. /customers, /users/{id}).
methodstringNoGETHTTP method: GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS.
descriptionstringNo""Human-readable description shown in the Console and Portal.
tagsstring[]No[]Endpoint-level tags for filtering in the Portal.

rate_limit​

FieldTypeRequiredDefaultDescription
requests_per_minuteintYesβ€”Maximum requests per minute. Must be > 0.
burstintNo0Burst allowance above requests_per_minute for brief spikes.

Example:

rate_limit:
requests_per_minute: 500
burst: 100

auth​

FieldTypeRequiredDefaultDescription
typestringYesβ€”Auth mechanism: jwt, api_key, mtls, oauth2, none.
issuerstringNoβ€”JWT/OAuth2 issuer URL (e.g. https://auth.acme.com/realms/prod).
headerstringNoβ€”Custom header name for API key auth (default: Authorization).
requiredboolNofalseIf true, unauthenticated requests are rejected with 401. If false, auth is optional.

Auth type values:

ValueDescription
jwtValidate JWT Bearer tokens. Use issuer to specify the JWKS endpoint.
api_keyValidate API keys via header or query param.
oauth2OAuth 2.0 token introspection. Use issuer for the authorization server.
mtlsMutual TLS client certificate validation.
noneNo authentication (passthrough).

Deployment via CLI​

stoactl deploy ./stoa.yaml --env production
stoactl deploy ./stoa.yaml --env dev --watch

The CLI reads and validates stoa.yaml locally before submitting to the Control Plane.

Validate without deploying​

stoactl validate ./stoa.yaml   # (planned β€” see roadmap)

Export existing API config​

stoactl get apis customer-api -o yaml > stoa.yaml

Environment Variables​

Use shell variables in string values to avoid hardcoding environment-specific URLs:

auth:
type: oauth2
issuer: ${STOA_AUTH_URL}/realms/acme

The CLI expands variables from the current shell environment before parsing.


Defaults Summary​

FieldDefault when absent
version1.0.0
endpoints[].methodGET
auth.requiredfalse
rate_limit (entire block)No rate limiting applied
auth (entire block)No auth required

Validation Errors​

The CLI validates stoa.yaml before sending to the API and returns human-readable errors:

ErrorCause
'name' is requiredname field is missing or empty
'name' must be 255 characters or fewerName too long
'version' must be a semantic versionInvalid format (e.g. v1.0 instead of 1.0.0)
endpoints[N].path is requiredAn endpoint entry is missing path
rate_limit.requests_per_minute must be > 0Zero or negative rate limit
auth.type must be one of: jwt, api_key, mtls, oauth2, noneUnknown auth type