API reference

The REST API at https://api.microsaas.app creates, lists, stops and deletes disposable services. This page is the read-only reference, generated from the API's own OpenAPI document, version 0.1.0.

Sign in to try it in the sandbox

The reference below cannot send requests. The sandbox needs a login. Command line tool and MCP server | OpenAPI JSON

Which endpoints exist?

60 operations. Authenticated calls send a bearer API key.

REST API operations
MethodPathSummary
GET/healthzLiveness plus reconciler freshness (for the status page)
GET/openapi.jsonThis document
GET/v1/accountTenant and caller scope
GET/v1/account/aupCurrent acceptable use policy: version, full text, whether this account must still accept it (required), the version it accepted. Open to an account that has not accepted
POST/v1/account/aup/acceptAccept the current version (409 aup_version_mismatch for any other); records version, time and user and audits it. Needs a session or an admin-tenant token; idempotent
DELETE/v1/account/runtimeRemove the stored cloud token (refused while services still run in that account)
GET/v1/account/runtimeState of the tenant's own cloud account (never the token)
PUT/v1/account/runtimeRegister the tenant's own cloud account (BYOK): the token is checked with a read-only call in each metro, sealed, and never returned. Name the metros as metro (one, or any) or metros (a list in create order, or ["any"]); any keeps every known metro the token answers in, a named list must answer in full (400 invalid_token names the failing metros)
DELETE/v1/account/webhookRemove the webhook endpoint; deliveries still pending are marked failed
GET/v1/account/webhookThe webhook endpoint, its events and whether it is enabled (never the secret)
PUT/v1/account/webhookSet the account's single outbound webhook endpoint (HTTPS, port 443 or 8443, public address) and the events it receives (default all); the signing secret is returned once, on creation. 404 unless CP_WEBHOOKS is on
GET/v1/account/webhook/deliveriesRecent deliveries, newest first, with status (pending, delivered, failed) and HTTP code only; pageable with limit and cursor
POST/v1/account/webhook/rotate-secretReplace the signing secret; the new one is returned once and signs every later delivery
POST/v1/account/webhook/testSend a signed webhook.test event to the endpoint now and report the HTTP status (one attempt, no retry)
GET/v1/auditAudit trail for the tenant (operators: all entries, including reconciler actions)
GET/v1/audit/verifyCheck the tenant's audit hash chain (HMAC-linked rows, retention checkpoints, recorded head): {ok, checked, first_bad, head_seq, head_hash}; keep head_seq/head_hash off the server to also detect truncation. Operators may add ?tenant=<id> or ?tenant=system
POST/v1/auth/active-orgPoint the cookie session at another org the user belongs to (else 403; 403 tenant_unavailable when suspended or deleting). Session only; tokens stay in the org they were minted in
GET/v1/auth/github/callbackVerify state, exchange the code, upsert user and personal tenant, set the session cookie, 302 to the console /profile (or /login?error=...)
GET/v1/auth/github/start302 to the GitHub authorize page (PKCE, 10 minute state); optional return_to on the console origin
POST/v1/auth/invites/acceptRedeem an invite token as the invited GitHub login; session only. Unknown, expired, used or foreign tokens are all 404 invalid_invite; 409 already_member
POST/v1/auth/logoutEnd the session and clear the cookie (needs X-MSAAS-CSRF)
POST/v1/auth/oidc/githubExchange a GitHub Actions OIDC JWT (audience microsaas) for a 15-minute deploy-scope token for the tenant a trust rule maps the repository/ref/environment to; never admin. Every failure is the same 403 oidc_denied; 404 unless OIDC trust is configured
GET/v1/auth/sessionIs the cookie session valid; returns expires_at and the per-session CSRF token. With CP_ORGS_INVITES on it also returns active_org_id and orgs [{id, name, role}]
GET/v1/auth/verifyIs the presented credential (access token, session or key) valid: scope, tenant and expiry, never the credential itself. 401 when it is not. Not charged against the AUP gate
POST/v1/billing/checkoutStart a subscription checkout for a plan and interval; returns the hosted checkout URL. 501 unless configured
POST/v1/billing/topupx402 prepaid top-up. Without X-PAYMENT: 402 with the payment requirements (x402Version, accepts[]). With X-PAYMENT: settles through the facilitator and credits once. 501 unless configured
POST/v1/billing/x402Same settlement as /v1/billing/topup for a client that already holds an X-PAYMENT header (400 payment_missing without it)
GET/v1/capacityShared running-slot capacity: running, max_running (0 = unlimited) and available (null = unlimited). available 0 means a create or start answers 503 capacity_full. No tenant or cost data. Instances in your own (BYOK) account hold no slot
GET/v1/catalogueList deployable services
GET/v1/catalogue/{id}Full contract of one service: resources, ports, generated secrets, config keys (env, type, default, range, settable), config files and the service's own API
GET/v1/keysList this tenant's active API keys (id, scope, label, created); the secret is never returned after creation
POST/v1/keysCreate an API key for this tenant
DELETE/v1/keys/{id}Revoke an API key
DELETE/v1/meStart account deletion: revoke tokens and sessions, schedule service deletion (session only)
GET/v1/meProfile and personal tenant
PATCH/v1/meUpdate display_name and notification_email (null clears)
GET/v1/orgs/{id}/invitesOrg invites with status open, consumed or expired, never the token. Admin or owner; 404 unless CP_ORGS_INVITES is on
POST/v1/orgs/{id}/invitesInvite a GitHub login or verified email as viewer, editor or admin (not owner). The invite token is returned once. Admin or owner; 409 duplicate_invite or invite_limit
DELETE/v1/orgs/{id}/invites/{inv}Revoke an invite. Admin or owner
GET/v1/orgs/{id}/membersMembers of the active org (any other id is 404): user_id, login, role, added_at. Any role may list
DELETE/v1/orgs/{id}/members/{user}Remove a member, or leave when user is yourself. Owner or the member, session only; ends their sessions, tokens and grants in the org at once. 409 sole_owner or no_other_org
PATCH/v1/orgs/{id}/members/{user}Change a member's role (viewer, editor, admin, owner). Owner with a session only; 409 sole_owner when it would leave no owner
POST/v1/sandbox/tokenMint a one-hour token for the docs sandbox (session + CSRF, or a user access token); 10 per minute
GET/v1/servicesList the tenant's services
POST/v1/servicesProvision a service (async, 202); budget and quota checked
GET/v1/services/metricsRuntime counters of the tenant's running services in one call (at most 20, oldest first; truncated is true beyond that). Each item carries metrics (same fields as one service) or, when the platform call failed, error {error, code} while the others still answer
DELETE/v1/services/{id}Delete a service and its volume (async)
GET/v1/services/{id}Get one service
POST/v1/services/{id}/extendLengthen a service's lifetime by whole hours, up to the plan's maximum TTL
GET/v1/services/{id}/logsNewest log lines of one service (query tail, 1..=1000, default 100); bearer tokens, platform token formats and the service's own secrets are redacted
GET/v1/services/{id}/metricsRuntime counters of one service: state, cpu_time_ms, rss_bytes, rx_bytes, tx_bytes and uptime_ms (since the last boot, null when not reported). rss_bytes is the resident memory the platform reports for the whole instance, including the guest kernel and runtime overhead; it can exceed the service's memory_mb and is not a utilisation figure
POST/v1/services/{id}/revealShow the service's generated credentials (audited). Create returns them once; list and get return them to API keys and access tokens but not to a console session, which uses this call
POST/v1/services/{id}/startStart a stopped service (202: the response shows state running, the state it is moving to; GET confirms)
POST/v1/services/{id}/stopStop a running service (volume kept, still billed; 202: the response shows state stopped, the state it is moving to; GET confirms)
GET/v1/tokensList access tokens (never the secret)
POST/v1/tokensCreate an access token; the secret is returned once
DELETE/v1/tokens/{id}Revoke a token immediately
POST/v1/tokens/{id}/rotateNew secret with the same name, scopes and lifetime; the old token is revoked
GET/v1/usageUsage ledger and balance; query from, to (unix seconds)
POST/v1/webhooks/paddlePayment provider webhook (raw body, Paddle-Signature header; the signature is the only credential). 404 unless Paddle is configured; 400 bad signature or event; replays answer duplicate

Full reference

Request and response schemas, parameters and status codes. This section needs JavaScript; the table above and the OpenAPI JSON do not.

Which services use a standard protocol?

Services that speak an existing standard are used with that standard's own clients and documentation, so they have no separate API reference here.

Last updated