{"components":{"securitySchemes":{"bearer":{"scheme":"bearer","type":"http"},"cookie":{"in":"cookie","name":"msaas_session","type":"apiKey"}}},"info":{"description":"Every credential (API key, access token, session, sandbox token) has its own token bucket; when it is empty the API answers 429 {\"error\",\"code\":\"rate_limited\",\"retry_after_s\"} with a Retry-After header in the same seconds; every 429 carries both. When the global running-instance cap is reached, creating or starting a service answers 503 {\"error\",\"code\":\"capacity_full\",\"retry_after_s\"} with Retry-After: 5; stop a service or retry. /healthz and /openapi.json are exempt.","title":"MicroSaaS.app control-plane API","version":"0.1.0"},"openapi":"3.0.3","paths":{"/healthz":{"get":{"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"ok":{"type":"boolean"},"reconciler_age_s":{"type":"integer"},"reconciler_last_ok":{"type":"integer"}},"required":["ok","reconciler_age_s","reconciler_last_ok"],"type":"object"}}},"description":"ok"},"default":{"content":{"application/json":{"schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"error"}},"summary":"Liveness plus reconciler freshness (for the status page)","x-sandbox":true}},"/openapi.json":{"get":{"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"ok":{"type":"boolean"}},"required":["ok"],"type":"object"}}},"description":"ok"},"default":{"content":{"application/json":{"schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"error"}},"summary":"This document","x-sandbox":true}},"/v1/account":{"get":{"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"active_ram_mb":{"type":"integer"},"active_services":{"type":"integer"},"plan":{"properties":{"active_hours_per_month":{"type":"integer"},"billing_interval":{"type":"string"},"byok_fee_micro_per_month":{"type":"integer"},"core_hours_per_month":{"type":"number"},"id":{"type":"string"},"idle_delete_days":{"type":"integer"},"invite_only":{"type":"boolean"},"max_active_accounts":{"nullable":true},"max_active_ram_mb":{"type":"integer"},"max_concurrent_active":{"type":"integer"},"max_services":{"type":"integer"},"max_standby":{"type":"integer"},"max_storage_chunks":{"type":"integer"},"max_tokens":{"type":"integer"},"max_ttl_s":{"type":"integer"},"mem_gib_hours_per_month":{"type":"number"},"name":{"type":"string"},"outbound_mb_per_month":{"type":"integer"},"smtp_daily_msgs":{"type":"integer"},"storage_gib_hours_per_month":{"type":"number"}},"required":["active_hours_per_month","billing_interval","byok_fee_micro_per_month","core_hours_per_month","id","idle_delete_days","invite_only","max_active_ram_mb","max_concurrent_active","max_services","max_standby","max_storage_chunks","max_tokens","max_ttl_s","mem_gib_hours_per_month","name","outbound_mb_per_month","smtp_daily_msgs","storage_gib_hours_per_month"],"type":"object"},"scope":{"type":"string"},"tenant":{"properties":{"aup_required":{"type":"boolean"},"aup_version":{"nullable":true},"balance_micro":{"type":"integer"},"created":{"type":"integer"},"deleting":{"type":"boolean"},"id":{"type":"string"},"name":{"type":"string"},"operator":{"type":"boolean"},"plan":{"type":"string"},"quota":{"nullable":true},"suspended":{"type":"boolean"}},"required":["aup_required","balance_micro","created","deleting","id","name","operator","plan","suspended"],"type":"object"}},"required":["active_ram_mb","active_services","plan","scope","tenant"],"type":"object"}}},"description":"ok"},"401":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["unauthorized"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"Missing, invalid or revoked credential"},"403":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["forbidden","tenant_unavailable"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"Scope too low or tenant unavailable"},"429":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["rate_limited"],"type":"string"},"error":{"type":"string"},"retry_after_s":{"description":"Same value as the Retry-After header","type":"integer"}},"required":["code","error"],"type":"object"}}},"description":"Rate limit reached","headers":{"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}}},"default":{"content":{"application/json":{"schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"error"}},"security":[{"bearer":[]}],"summary":"Tenant and caller scope","x-required-scope":"read","x-sandbox":true}},"/v1/account/aup":{"get":{"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"accept_url":{"type":"string"},"accepted_at":{"nullable":true},"accepted_version":{"nullable":true},"grandfathered":{"type":"boolean"},"required":{"type":"boolean"},"text":{"type":"string"},"version":{"type":"string"}},"required":["accept_url","grandfathered","required","text","version"],"type":"object"}}},"description":"ok"},"default":{"content":{"application/json":{"schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"error"}},"security":[{"bearer":[]},{"cookie":[]}],"summary":"Current 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","x-auth":"session-or-token"}},"/v1/account/aup/accept":{"post":{"requestBody":{"content":{"application/json":{"schema":{"properties":{"version":{"type":"string"}},"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"accepted_at":{"type":"integer"},"ok":{"type":"boolean"},"version":{"type":"string"}},"required":["accepted_at","ok","version"],"type":"object"}}},"description":"ok"},"default":{"content":{"application/json":{"schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"error"}},"security":[{"bearer":[]},{"cookie":[]}],"summary":"Accept 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","x-auth":"session-or-token"}},"/v1/account/runtime":{"delete":{"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"ok":{"type":"boolean"}},"required":["ok"],"type":"object"}}},"description":"ok"},"401":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["unauthorized"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"Missing, invalid or revoked credential"},"403":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["forbidden","tenant_unavailable"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"Scope too low or tenant unavailable"},"429":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["rate_limited"],"type":"string"},"error":{"type":"string"},"retry_after_s":{"description":"Same value as the Retry-After header","type":"integer"}},"required":["code","error"],"type":"object"}}},"description":"Rate limit reached","headers":{"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}}},"default":{"content":{"application/json":{"schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"error"}},"security":[{"bearer":[]}],"summary":"Remove the stored cloud token (refused while services still run in that account)","x-required-scope":"admin"},"get":{"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"checked_at":{"type":"integer"},"endpoint":{"type":"string"},"error":{"type":"string"},"metros":{"items":{"type":"string"},"type":"array"},"status":{"type":"string"},"updated":{"type":"integer"}},"required":["checked_at","endpoint","error","metros","status","updated"],"type":"object"}}},"description":"ok"},"401":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["unauthorized"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"Missing, invalid or revoked credential"},"403":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["forbidden","tenant_unavailable"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"Scope too low or tenant unavailable"},"429":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["rate_limited"],"type":"string"},"error":{"type":"string"},"retry_after_s":{"description":"Same value as the Retry-After header","type":"integer"}},"required":["code","error"],"type":"object"}}},"description":"Rate limit reached","headers":{"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}}},"default":{"content":{"application/json":{"schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"error"}},"security":[{"bearer":[]}],"summary":"State of the tenant's own cloud account (never the token)","x-required-scope":"read"},"put":{"requestBody":{"content":{"application/json":{"schema":{"properties":{"metros":{"items":{"type":"string"},"type":"array"},"token":{"type":"string"}},"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"checked_at":{"type":"integer"},"endpoint":{"type":"string"},"metros":{"items":{"type":"string"},"type":"array"},"status":{"type":"string"},"updated":{"type":"integer"}},"required":["checked_at","endpoint","metros","status","updated"],"type":"object"}}},"description":"ok"},"401":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["unauthorized"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"Missing, invalid or revoked credential"},"403":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["forbidden","tenant_unavailable"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"Scope too low or tenant unavailable"},"429":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["rate_limited"],"type":"string"},"error":{"type":"string"},"retry_after_s":{"description":"Same value as the Retry-After header","type":"integer"}},"required":["code","error"],"type":"object"}}},"description":"Rate limit reached","headers":{"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}}},"default":{"content":{"application/json":{"schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"error"}},"security":[{"bearer":[]}],"summary":"Register 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)","x-required-scope":"admin"}},"/v1/account/webhook":{"delete":{"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"ok":{"type":"boolean"}},"required":["ok"],"type":"object"}}},"description":"ok"},"401":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["unauthorized"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"Missing, invalid or revoked credential"},"403":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["forbidden","tenant_unavailable"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"Scope too low or tenant unavailable"},"429":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["rate_limited"],"type":"string"},"error":{"type":"string"},"retry_after_s":{"description":"Same value as the Retry-After header","type":"integer"}},"required":["code","error"],"type":"object"}}},"description":"Rate limit reached","headers":{"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}}},"default":{"content":{"application/json":{"schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"error"}},"security":[{"bearer":[]}],"summary":"Remove the webhook endpoint; deliveries still pending are marked failed","x-required-scope":"admin"},"get":{"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"created":{"type":"integer"},"enabled":{"type":"boolean"},"events":{"items":{"type":"string"},"type":"array"},"updated":{"type":"integer"},"url":{"type":"string"}},"required":["created","enabled","events","updated","url"],"type":"object"}}},"description":"ok"},"401":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["unauthorized"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"Missing, invalid or revoked credential"},"403":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["forbidden","tenant_unavailable"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"Scope too low or tenant unavailable"},"429":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["rate_limited"],"type":"string"},"error":{"type":"string"},"retry_after_s":{"description":"Same value as the Retry-After header","type":"integer"}},"required":["code","error"],"type":"object"}}},"description":"Rate limit reached","headers":{"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}}},"default":{"content":{"application/json":{"schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"error"}},"security":[{"bearer":[]}],"summary":"The webhook endpoint, its events and whether it is enabled (never the secret)","x-required-scope":"read"},"put":{"requestBody":{"content":{"application/json":{"schema":{"properties":{"events":{"items":{"type":"string"},"type":"array"},"url":{"type":"string"}},"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"created":{"type":"integer"},"enabled":{"type":"boolean"},"events":{"items":{"type":"string"},"type":"array"},"secret":{"type":"string"},"updated":{"type":"integer"},"url":{"type":"string"}},"required":["created","enabled","events","secret","updated","url"],"type":"object"}}},"description":"ok"},"401":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["unauthorized"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"Missing, invalid or revoked credential"},"403":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["forbidden","tenant_unavailable"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"Scope too low or tenant unavailable"},"429":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["rate_limited"],"type":"string"},"error":{"type":"string"},"retry_after_s":{"description":"Same value as the Retry-After header","type":"integer"}},"required":["code","error"],"type":"object"}}},"description":"Rate limit reached","headers":{"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}}},"default":{"content":{"application/json":{"schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"error"}},"security":[{"bearer":[]}],"summary":"Set 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","x-required-scope":"admin"}},"/v1/account/webhook/deliveries":{"get":{"responses":{"200":{"content":{"application/json":{"schema":{"items":{"properties":{"attempts":{"type":"integer"},"created":{"type":"integer"},"event":{"type":"string"},"http_code":{"type":"integer"},"id":{"type":"string"},"status":{"type":"string"},"updated":{"type":"integer"}},"required":["attempts","created","event","http_code","id","status","updated"],"type":"object"},"type":"array"}}},"description":"ok"},"401":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["unauthorized"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"Missing, invalid or revoked credential"},"403":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["forbidden","tenant_unavailable"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"Scope too low or tenant unavailable"},"429":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["rate_limited"],"type":"string"},"error":{"type":"string"},"retry_after_s":{"description":"Same value as the Retry-After header","type":"integer"}},"required":["code","error"],"type":"object"}}},"description":"Rate limit reached","headers":{"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}}},"default":{"content":{"application/json":{"schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"error"}},"security":[{"bearer":[]}],"summary":"Recent deliveries, newest first, with status (pending, delivered, failed) and HTTP code only; pageable with limit and cursor","x-required-scope":"read"}},"/v1/account/webhook/rotate-secret":{"post":{"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"secret":{"type":"string"}},"required":["secret"],"type":"object"}}},"description":"ok"},"401":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["unauthorized"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"Missing, invalid or revoked credential"},"403":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["forbidden","tenant_unavailable"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"Scope too low or tenant unavailable"},"429":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["rate_limited"],"type":"string"},"error":{"type":"string"},"retry_after_s":{"description":"Same value as the Retry-After header","type":"integer"}},"required":["code","error"],"type":"object"}}},"description":"Rate limit reached","headers":{"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}}},"default":{"content":{"application/json":{"schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"error"}},"security":[{"bearer":[]}],"summary":"Replace the signing secret; the new one is returned once and signs every later delivery","x-required-scope":"admin"}},"/v1/account/webhook/test":{"post":{"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"delivery":{"type":"string"},"http_code":{"type":"integer"},"status":{"type":"string"}},"required":["delivery","http_code","status"],"type":"object"}}},"description":"ok"},"401":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["unauthorized"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"Missing, invalid or revoked credential"},"403":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["forbidden","tenant_unavailable"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"Scope too low or tenant unavailable"},"429":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["rate_limited"],"type":"string"},"error":{"type":"string"},"retry_after_s":{"description":"Same value as the Retry-After header","type":"integer"}},"required":["code","error"],"type":"object"}}},"description":"Rate limit reached","headers":{"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}}},"default":{"content":{"application/json":{"schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"error"}},"security":[{"bearer":[]}],"summary":"Send a signed webhook.test event to the endpoint now and report the HTTP status (one attempt, no retry)","x-required-scope":"admin"}},"/v1/audit":{"get":{"parameters":[{"description":"Page size, 1-500 (default 50, larger values are clamped). With limit or cursor the response is {items, next_cursor}, newest first; without either it is the plain, unpaged response","in":"query","name":"limit","required":false,"schema":{"maximum":500,"minimum":1,"type":"integer"}},{"description":"Opaque next_cursor from the previous page","in":"query","name":"cursor","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"properties":{"action":{"type":"string"},"actor":{"type":"string"},"at":{"type":"integer"},"detail":{"type":"string"},"id":{"type":"integer"},"target":{"type":"string"},"tenant":{"type":"string"}},"required":["action","actor","at","detail","id","target","tenant"],"type":"object"},"type":"array"}}},"description":"ok"},"400":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["bad_limit","bad_cursor"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"Bad limit or cursor"},"401":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["unauthorized"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"Missing, invalid or revoked credential"},"403":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["forbidden","tenant_unavailable"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"Scope too low or tenant unavailable"},"429":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["rate_limited"],"type":"string"},"error":{"type":"string"},"retry_after_s":{"description":"Same value as the Retry-After header","type":"integer"}},"required":["code","error"],"type":"object"}}},"description":"Rate limit reached","headers":{"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}}},"default":{"content":{"application/json":{"schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"error"}},"security":[{"bearer":[]}],"summary":"Audit trail for the tenant (operators: all entries, including reconciler actions)","x-required-scope":"admin"}},"/v1/audit/verify":{"get":{"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"checked":{"type":"integer"},"first_bad":{"nullable":true},"head_hash":{"type":"string"},"head_seq":{"type":"integer"},"ok":{"type":"boolean"}},"required":["checked","head_hash","head_seq","ok"],"type":"object"}}},"description":"ok"},"401":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["unauthorized"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"Missing, invalid or revoked credential"},"403":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["forbidden","tenant_unavailable"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"Scope too low or tenant unavailable"},"429":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["rate_limited"],"type":"string"},"error":{"type":"string"},"retry_after_s":{"description":"Same value as the Retry-After header","type":"integer"}},"required":["code","error"],"type":"object"}}},"description":"Rate limit reached","headers":{"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}}},"default":{"content":{"application/json":{"schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"error"}},"security":[{"bearer":[]}],"summary":"Check 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","x-required-scope":"admin"}},"/v1/auth/active-org":{"post":{"requestBody":{"content":{"application/json":{"schema":{"properties":{"org_id":{"type":"string"}},"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"active_org_id":{"type":"string"},"role":{"type":"string"}},"required":["active_org_id","role"],"type":"object"}}},"description":"ok"},"default":{"content":{"application/json":{"schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"error"}},"security":[{"bearer":[]},{"cookie":[]}],"summary":"Point 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","x-auth":"session"}},"/v1/auth/github/callback":{"get":{"responses":{"302":{"content":{"application/json":{"schema":{"properties":{},"type":"object"}}},"description":"ok"},"default":{"content":{"application/json":{"schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"error"}},"summary":"Verify state, exchange the code, upsert user and personal tenant, set the session cookie, 302 to the console /profile (or /login?error=...)","x-auth":"public"}},"/v1/auth/github/start":{"get":{"responses":{"302":{"content":{"application/json":{"schema":{"properties":{},"type":"object"}}},"description":"ok"},"default":{"content":{"application/json":{"schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"error"}},"summary":"302 to the GitHub authorize page (PKCE, 10 minute state); optional return_to on the console origin","x-auth":"public"}},"/v1/auth/invites/accept":{"post":{"requestBody":{"content":{"application/json":{"schema":{"properties":{"token":{"type":"string"}},"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"invite_id":{"type":"string"},"org_id":{"type":"string"},"role":{"type":"string"}},"required":["invite_id","org_id","role"],"type":"object"}}},"description":"ok"},"default":{"content":{"application/json":{"schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"error"}},"security":[{"bearer":[]},{"cookie":[]}],"summary":"Redeem an invite token as the invited GitHub login; session only. Unknown, expired, used or foreign tokens are all 404 invalid_invite; 409 already_member","x-auth":"session"}},"/v1/auth/logout":{"post":{"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"ok":{"type":"boolean"}},"required":["ok"],"type":"object"}}},"description":"ok"},"default":{"content":{"application/json":{"schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"error"}},"security":[{"bearer":[]},{"cookie":[]}],"summary":"End the session and clear the cookie (needs X-MSAAS-CSRF)","x-auth":"session"}},"/v1/auth/oidc/github":{"post":{"requestBody":{"content":{"application/json":{"schema":{"properties":{"token":{"type":"string"}},"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"expires_at":{"type":"integer"},"scopes":{"items":{"type":"string"},"type":"array"},"tenant":{"type":"string"},"token":{"type":"string"}},"required":["expires_at","scopes","tenant","token"],"type":"object"}}},"description":"ok"},"default":{"content":{"application/json":{"schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"error"}},"summary":"Exchange 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"}},"/v1/auth/session":{"get":{"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"active_org_id":{"type":"string"},"aup_required":{"type":"boolean"},"csrf_token":{"type":"string"},"expires_at":{"type":"integer"},"is_authenticated":{"type":"boolean"},"orgs":{"items":{"properties":{"id":{"type":"string"},"name":{"type":"string"},"role":{"type":"string"}},"required":["id","name","role"],"type":"object"},"type":"array"},"user_id":{"type":"string"}},"required":["active_org_id","aup_required","csrf_token","expires_at","is_authenticated","orgs","user_id"],"type":"object"}}},"description":"ok"},"default":{"content":{"application/json":{"schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"error"}},"summary":"Is 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}]","x-auth":"public"}},"/v1/auth/verify":{"get":{"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"expires_at":{"type":"integer"},"scope":{"type":"string"},"scopes":{"items":{"type":"string"},"type":"array"},"tenant":{"type":"string"},"valid":{"type":"boolean"}},"required":["expires_at","scope","scopes","tenant","valid"],"type":"object"}}},"description":"ok"},"default":{"content":{"application/json":{"schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"error"}},"security":[{"bearer":[]},{"cookie":[]}],"summary":"Is 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","x-auth":"session-or-token"}},"/v1/billing/checkout":{"post":{"requestBody":{"content":{"application/json":{"schema":{"properties":{"interval":{"type":"string"},"plan":{"type":"string"}},"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"url":{"type":"string"}},"required":["url"],"type":"object"}}},"description":"ok"},"401":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["unauthorized"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"Missing, invalid or revoked credential"},"403":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["forbidden","tenant_unavailable"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"Scope too low or tenant unavailable"},"429":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["rate_limited"],"type":"string"},"error":{"type":"string"},"retry_after_s":{"description":"Same value as the Retry-After header","type":"integer"}},"required":["code","error"],"type":"object"}}},"description":"Rate limit reached","headers":{"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}}},"default":{"content":{"application/json":{"schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"error"}},"security":[{"bearer":[]}],"summary":"Start a subscription checkout for a plan and interval; returns the hosted checkout URL. 501 unless configured","x-required-scope":"admin"}},"/v1/billing/topup":{"post":{"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"applied":{"type":"boolean"},"balance_micro":{"type":"integer"},"reference":{"type":"string"}},"required":["applied","balance_micro","reference"],"type":"object"}}},"description":"ok"},"401":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["unauthorized"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"Missing, invalid or revoked credential"},"403":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["forbidden","tenant_unavailable"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"Scope too low or tenant unavailable"},"429":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["rate_limited"],"type":"string"},"error":{"type":"string"},"retry_after_s":{"description":"Same value as the Retry-After header","type":"integer"}},"required":["code","error"],"type":"object"}}},"description":"Rate limit reached","headers":{"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}}},"default":{"content":{"application/json":{"schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"error"}},"security":[{"bearer":[]}],"summary":"x402 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","x-required-scope":"deploy"}},"/v1/billing/x402":{"post":{"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"applied":{"type":"boolean"},"balance_micro":{"type":"integer"},"reference":{"type":"string"}},"required":["applied","balance_micro","reference"],"type":"object"}}},"description":"ok"},"401":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["unauthorized"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"Missing, invalid or revoked credential"},"403":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["forbidden","tenant_unavailable"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"Scope too low or tenant unavailable"},"429":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["rate_limited"],"type":"string"},"error":{"type":"string"},"retry_after_s":{"description":"Same value as the Retry-After header","type":"integer"}},"required":["code","error"],"type":"object"}}},"description":"Rate limit reached","headers":{"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}}},"default":{"content":{"application/json":{"schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"error"}},"security":[{"bearer":[]}],"summary":"Same settlement as /v1/billing/topup for a client that already holds an X-PAYMENT header (400 payment_missing without it)","x-required-scope":"deploy"}},"/v1/capacity":{"get":{"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"available":{"type":"integer"},"max_running":{"type":"integer"},"running":{"type":"integer"}},"required":["available","max_running","running"],"type":"object"}}},"description":"ok"},"401":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["unauthorized"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"Missing, invalid or revoked credential"},"403":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["forbidden","tenant_unavailable"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"Scope too low or tenant unavailable"},"429":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["rate_limited"],"type":"string"},"error":{"type":"string"},"retry_after_s":{"description":"Same value as the Retry-After header","type":"integer"}},"required":["code","error"],"type":"object"}}},"description":"Rate limit reached","headers":{"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}}},"default":{"content":{"application/json":{"schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"error"}},"security":[{"bearer":[]}],"summary":"Shared 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","x-required-scope":"read"}},"/v1/catalogue":{"get":{"responses":{"200":{"content":{"application/json":{"schema":{"items":{"properties":{"category":{"type":"string"},"description":{"type":"string"},"id":{"type":"string"},"memory_mb_default":{"type":"integer"},"memory_mb_min":{"type":"integer"},"protocols":{"items":{"type":"string"},"type":"array"},"status":{"type":"string"},"storage_chunks":{"type":"integer"},"ttl_default_s":{"type":"integer"},"ttl_max_s":{"type":"integer"},"volume_mb":{"type":"integer"}},"required":["category","description","id","memory_mb_default","memory_mb_min","protocols","status","storage_chunks","ttl_default_s","ttl_max_s","volume_mb"],"type":"object"},"type":"array"}}},"description":"ok"},"401":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["unauthorized"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"Missing, invalid or revoked credential"},"403":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["forbidden","tenant_unavailable"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"Scope too low or tenant unavailable"},"429":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["rate_limited"],"type":"string"},"error":{"type":"string"},"retry_after_s":{"description":"Same value as the Retry-After header","type":"integer"}},"required":["code","error"],"type":"object"}}},"description":"Rate limit reached","headers":{"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}}},"default":{"content":{"application/json":{"schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"error"}},"security":[{"bearer":[]}],"summary":"List deployable services","x-required-scope":"read","x-sandbox":true}},"/v1/catalogue/{id}":{"get":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"api":{"items":{"properties":{"auth":{"type":"string"},"endpoints":{"items":{"properties":{"auth":{"type":"string"},"method":{"type":"string"},"path":{"type":"string"},"summary":{"type":"string"}},"required":["auth","method","path","summary"],"type":"object"},"type":"array"},"kind":{"type":"string"},"name":{"type":"string"},"port":{"type":"integer"},"protocol":{"type":"string"}},"required":["auth","endpoints","kind","name","port","protocol"],"type":"object"},"type":"array"},"category":{"type":"string"},"config":{"items":{"properties":{"default":{"type":"string"},"description":{"type":"string"},"env":{"type":"string"},"key":{"type":"string"},"min":{"type":"integer"},"required":{"type":"boolean"},"restart_required":{"type":"boolean"},"secret":{"type":"boolean"},"settable":{"type":"boolean"},"source":{"type":"string"},"type":{"type":"string"}},"type":"object"},"type":"array"},"description":{"type":"string"},"files":{"items":{},"type":"array"},"generated_secrets":{"items":{"properties":{"bytes":{"type":"integer"},"env":{"type":"string"},"hex_chars":{"type":"integer"},"reveal":{"type":"boolean"}},"required":["bytes","env","hex_chars","reveal"],"type":"object"},"type":"array"},"id":{"type":"string"},"ports":{"items":{"properties":{"auth":{"type":"string"},"port":{"type":"integer"},"protocol":{"type":"string"}},"required":["auth","port","protocol"],"type":"object"},"type":"array"},"resources":{"properties":{"memory_mb_default":{"type":"integer"},"memory_min_mb":{"type":"integer"},"storage_chunks":{"type":"integer"},"vcpus":{"type":"integer"},"volume_mb":{"type":"integer"}},"required":["memory_mb_default","memory_min_mb","storage_chunks","vcpus","volume_mb"],"type":"object"},"status":{"type":"string"},"verified":{"type":"string"}},"required":["api","category","description","files","generated_secrets","id","ports","resources","status","verified"],"type":"object"}}},"description":"ok"},"401":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["unauthorized"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"Missing, invalid or revoked credential"},"403":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["forbidden","tenant_unavailable"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"Scope too low or tenant unavailable"},"404":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["not_found"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"No such resource (the same body for another tenant's id)"},"429":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["rate_limited"],"type":"string"},"error":{"type":"string"},"retry_after_s":{"description":"Same value as the Retry-After header","type":"integer"}},"required":["code","error"],"type":"object"}}},"description":"Rate limit reached","headers":{"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}}},"default":{"content":{"application/json":{"schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"error"}},"security":[{"bearer":[]}],"summary":"Full contract of one service: resources, ports, generated secrets, config keys (env, type, default, range, settable), config files and the service's own API","x-required-scope":"read","x-sandbox":true}},"/v1/keys":{"get":{"parameters":[{"description":"Page size, 1-500 (default 50, larger values are clamped). With limit or cursor the response is {items, next_cursor}, newest first; without either it is the plain, unpaged response","in":"query","name":"limit","required":false,"schema":{"maximum":500,"minimum":1,"type":"integer"}},{"description":"Opaque next_cursor from the previous page","in":"query","name":"cursor","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"properties":{"created":{"type":"integer"},"id":{"type":"string"},"label":{"type":"string"},"scope":{"type":"string"}},"required":["created","id","label","scope"],"type":"object"},"type":"array"}}},"description":"ok"},"400":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["bad_limit","bad_cursor"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"Bad limit or cursor"},"401":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["unauthorized"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"Missing, invalid or revoked credential"},"403":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["forbidden","tenant_unavailable"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"Scope too low or tenant unavailable"},"429":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["rate_limited"],"type":"string"},"error":{"type":"string"},"retry_after_s":{"description":"Same value as the Retry-After header","type":"integer"}},"required":["code","error"],"type":"object"}}},"description":"Rate limit reached","headers":{"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}}},"default":{"content":{"application/json":{"schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"error"}},"security":[{"bearer":[]}],"summary":"List this tenant's active API keys (id, scope, label, created); the secret is never returned after creation","x-required-scope":"admin"},"post":{"requestBody":{"content":{"application/json":{"schema":{"properties":{"label":{"type":"string"},"scope":{"type":"string"}},"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"id":{"type":"string"},"key":{"type":"string"},"scope":{"type":"string"}},"required":["id","key","scope"],"type":"object"}}},"description":"ok"},"401":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["unauthorized"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"Missing, invalid or revoked credential"},"403":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["forbidden","tenant_unavailable"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"Scope too low or tenant unavailable"},"429":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["rate_limited"],"type":"string"},"error":{"type":"string"},"retry_after_s":{"description":"Same value as the Retry-After header","type":"integer"}},"required":["code","error"],"type":"object"}}},"description":"Rate limit reached","headers":{"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}}},"default":{"content":{"application/json":{"schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"error"}},"security":[{"bearer":[]}],"summary":"Create an API key for this tenant","x-required-scope":"admin"}},"/v1/keys/{id}":{"delete":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"ok":{"type":"boolean"}},"required":["ok"],"type":"object"}}},"description":"ok"},"401":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["unauthorized"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"Missing, invalid or revoked credential"},"403":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["forbidden","tenant_unavailable"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"Scope too low or tenant unavailable"},"404":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["not_found"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"No such resource (the same body for another tenant's id)"},"429":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["rate_limited"],"type":"string"},"error":{"type":"string"},"retry_after_s":{"description":"Same value as the Retry-After header","type":"integer"}},"required":["code","error"],"type":"object"}}},"description":"Rate limit reached","headers":{"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}}},"default":{"content":{"application/json":{"schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"error"}},"security":[{"bearer":[]}],"summary":"Revoke an API key","x-required-scope":"admin"}},"/v1/me":{"delete":{"requestBody":{"content":{"application/json":{"schema":{"properties":{"confirm":{"type":"string"}},"type":"object"}}},"required":true},"responses":{"202":{"content":{"application/json":{"schema":{"properties":{"services_scheduled":{"type":"integer"},"status":{"type":"string"},"tokens_revoked":{"type":"integer"}},"required":["services_scheduled","status","tokens_revoked"],"type":"object"}}},"description":"ok"},"default":{"content":{"application/json":{"schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"error"}},"security":[{"bearer":[]},{"cookie":[]}],"summary":"Start account deletion: revoke tokens and sessions, schedule service deletion (session only)","x-auth":"session"},"get":{"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"avatar_url":{"type":"string"},"created_at":{"type":"integer"},"display_name":{"nullable":true},"email":{"type":"string"},"id":{"type":"string"},"last_login_at":{"type":"integer"},"login":{"type":"string"},"name":{"type":"string"},"notification_email":{"nullable":true},"tenant":{"properties":{"credits_micro":{"type":"integer"},"id":{"type":"string"},"plan":{"type":"string"},"services_count":{"type":"integer"}},"required":["credits_micro","id","plan","services_count"],"type":"object"}},"required":["avatar_url","created_at","email","id","last_login_at","login","name","tenant"],"type":"object"}}},"description":"ok"},"default":{"content":{"application/json":{"schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"error"}},"security":[{"bearer":[]},{"cookie":[]}],"summary":"Profile and personal tenant","x-auth":"session-or-token"},"patch":{"requestBody":{"content":{"application/json":{"schema":{"properties":{"display_name":{"type":"string"},"notification_email":{"type":"string"}},"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"avatar_url":{"type":"string"},"created_at":{"type":"integer"},"display_name":{"nullable":true},"email":{"type":"string"},"id":{"type":"string"},"last_login_at":{"type":"integer"},"login":{"type":"string"},"name":{"type":"string"},"notification_email":{"nullable":true},"tenant":{"properties":{"credits_micro":{"type":"integer"},"id":{"type":"string"},"plan":{"type":"string"},"services_count":{"type":"integer"}},"required":["credits_micro","id","plan","services_count"],"type":"object"}},"required":["avatar_url","created_at","email","id","last_login_at","login","name","tenant"],"type":"object"}}},"description":"ok"},"default":{"content":{"application/json":{"schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"error"}},"security":[{"bearer":[]},{"cookie":[]}],"summary":"Update display_name and notification_email (null clears)","x-auth":"session-or-token"}},"/v1/orgs/{id}/invites":{"get":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"description":"Page size, 1-500 (default 50, larger values are clamped). With limit or cursor the response is {items, next_cursor}, newest first; without either it is the plain, unpaged response","in":"query","name":"limit","required":false,"schema":{"maximum":500,"minimum":1,"type":"integer"}},{"description":"Opaque next_cursor from the previous page","in":"query","name":"cursor","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"invites":{"items":{"properties":{"created_at":{"type":"integer"},"created_by":{"type":"string"},"expires_at":{"type":"integer"},"id":{"type":"string"},"kind":{"type":"string"},"role":{"type":"string"},"status":{"type":"string"},"value":{"type":"string"}},"required":["created_at","created_by","expires_at","id","kind","role","status","value"],"type":"object"},"type":"array"}},"required":["invites"],"type":"object"}}},"description":"ok"},"400":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["bad_limit","bad_cursor"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"Bad limit or cursor"},"default":{"content":{"application/json":{"schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"error"}},"security":[{"bearer":[]},{"cookie":[]}],"summary":"Org invites with status open, consumed or expired, never the token. Admin or owner; 404 unless CP_ORGS_INVITES is on","x-auth":"session-or-token"},"post":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"login":{"type":"string"},"role":{"type":"string"}},"type":"object"}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"properties":{"created_at":{"type":"integer"},"created_by":{"type":"string"},"expires_at":{"type":"integer"},"id":{"type":"string"},"kind":{"type":"string"},"role":{"type":"string"},"status":{"type":"string"},"token":{"type":"string"},"value":{"type":"string"}},"required":["created_at","created_by","expires_at","id","kind","role","status","token","value"],"type":"object"}}},"description":"ok"},"default":{"content":{"application/json":{"schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"error"}},"security":[{"bearer":[]},{"cookie":[]}],"summary":"Invite 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","x-auth":"session-or-token"}},"/v1/orgs/{id}/invites/{inv}":{"delete":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"in":"path","name":"inv","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"ok":{"type":"boolean"}},"required":["ok"],"type":"object"}}},"description":"ok"},"default":{"content":{"application/json":{"schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"error"}},"security":[{"bearer":[]},{"cookie":[]}],"summary":"Revoke an invite. Admin or owner","x-auth":"session-or-token"}},"/v1/orgs/{id}/members":{"get":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"description":"Page size, 1-500 (default 50, larger values are clamped). With limit or cursor the response is {items, next_cursor}, newest first; without either it is the plain, unpaged response","in":"query","name":"limit","required":false,"schema":{"maximum":500,"minimum":1,"type":"integer"}},{"description":"Opaque next_cursor from the previous page","in":"query","name":"cursor","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"members":{"items":{"properties":{"added_at":{"type":"integer"},"login":{"type":"string"},"role":{"type":"string"},"user_id":{"type":"string"}},"required":["added_at","login","role","user_id"],"type":"object"},"type":"array"}},"required":["members"],"type":"object"}}},"description":"ok"},"400":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["bad_limit","bad_cursor"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"Bad limit or cursor"},"default":{"content":{"application/json":{"schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"error"}},"security":[{"bearer":[]},{"cookie":[]}],"summary":"Members of the active org (any other id is 404): user_id, login, role, added_at. Any role may list","x-auth":"session-or-token"}},"/v1/orgs/{id}/members/{user}":{"delete":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"in":"path","name":"user","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"ok":{"type":"boolean"},"user_id":{"type":"string"}},"required":["ok","user_id"],"type":"object"}}},"description":"ok"},"default":{"content":{"application/json":{"schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"error"}},"security":[{"bearer":[]},{"cookie":[]}],"summary":"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","x-auth":"session"},"patch":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"in":"path","name":"user","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"role":{"type":"string"}},"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"added_at":{"type":"integer"},"login":{"type":"string"},"role":{"type":"string"},"user_id":{"type":"string"}},"required":["added_at","login","role","user_id"],"type":"object"}}},"description":"ok"},"default":{"content":{"application/json":{"schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"error"}},"security":[{"bearer":[]},{"cookie":[]}],"summary":"Change a member's role (viewer, editor, admin, owner). Owner with a session only; 409 sole_owner when it would leave no owner","x-auth":"session"}},"/v1/sandbox/token":{"post":{"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"base_url":{"type":"string"},"expires_at":{"type":"integer"},"token":{"type":"string"}},"required":["base_url","expires_at","token"],"type":"object"}}},"description":"ok"}},"security":[{"bearer":[]},{"cookie":[]}],"summary":"Mint a one-hour token for the docs sandbox (session + CSRF, or a user access token); 10 per minute"}},"/v1/services":{"get":{"parameters":[{"description":"Page size, 1-500 (default 50, larger values are clamped). With limit or cursor the response is {items, next_cursor}, newest first; without either it is the plain, unpaged response","in":"query","name":"limit","required":false,"schema":{"maximum":500,"minimum":1,"type":"integer"}},{"description":"Opaque next_cursor from the previous page","in":"query","name":"cursor","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"services":{"items":{"properties":{"config":{"properties":{"max_db_bytes":{"type":"string"}},"type":"object"},"crash_loop":{"type":"boolean"},"created":{"type":"integer"},"expires_at":{"type":"integer"},"health":{"type":"string"},"id":{"type":"string"},"last_error":{"type":"string"},"memory_mb":{"type":"integer"},"name":{"type":"string"},"restarts":{"type":"integer"},"secrets":{"properties":{"API_KEY":{"type":"string"}},"type":"object"},"service":{"type":"string"},"state":{"type":"string"},"storage_chunks":{"type":"integer"},"ttl_s":{"type":"integer"},"url":{"type":"string"},"vcpus":{"type":"integer"},"volume_mb":{"type":"integer"}},"required":["crash_loop","created","expires_at","health","id","last_error","memory_mb","name","restarts","service","state","storage_chunks","ttl_s","url","vcpus","volume_mb"],"type":"object"},"type":"array"}},"required":["services"],"type":"object"}}},"description":"ok"},"400":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["bad_limit","bad_cursor"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"Bad limit or cursor"},"401":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["unauthorized"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"Missing, invalid or revoked credential"},"403":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["forbidden","tenant_unavailable"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"Scope too low or tenant unavailable"},"429":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["rate_limited"],"type":"string"},"error":{"type":"string"},"retry_after_s":{"description":"Same value as the Retry-After header","type":"integer"}},"required":["code","error"],"type":"object"}}},"description":"Rate limit reached","headers":{"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}}},"default":{"content":{"application/json":{"schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"error"}},"security":[{"bearer":[]}],"summary":"List the tenant's services","x-required-scope":"read","x-sandbox":true},"post":{"parameters":[{"description":"1-128 characters. The same key and body within 24 h, per tenant, returns the original service with Idempotent-Replayed: true and creates nothing; the same key with another body is 422 idempotency_conflict","in":"header","name":"Idempotency-Key","required":false,"schema":{"maxLength":128,"minLength":1,"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"config":{"additionalProperties":{"oneOf":[{"type":"string"},{"type":"number"},{"type":"boolean"}]},"description":"Service configuration for the keys marked settable in GET /v1/catalogue/{id}; unknown, non-settable or invalid keys are rejected with 400 bad_config listing every error.","type":"object"},"memory_mb":{"type":"integer"},"metro":{"type":"string"},"name":{"type":"string"},"service":{"type":"string"},"ttl_s":{"type":"integer"}},"type":"object"}}},"required":true},"responses":{"202":{"content":{"application/json":{"schema":{"properties":{"config":{"properties":{"max_db_bytes":{"type":"string"}},"type":"object"},"crash_loop":{"type":"boolean"},"created":{"type":"integer"},"expires_at":{"type":"integer"},"health":{"type":"string"},"id":{"type":"string"},"last_error":{"type":"string"},"memory_mb":{"type":"integer"},"name":{"type":"string"},"restarts":{"type":"integer"},"secrets":{"properties":{"API_KEY":{"type":"string"}},"type":"object"},"service":{"type":"string"},"state":{"type":"string"},"storage_chunks":{"type":"integer"},"ttl_s":{"type":"integer"},"url":{"type":"string"},"vcpus":{"type":"integer"},"volume_mb":{"type":"integer"}},"required":["crash_loop","created","expires_at","health","id","last_error","memory_mb","name","restarts","service","state","storage_chunks","ttl_s","url","vcpus","volume_mb"],"type":"object"}}},"description":"ok","headers":{"Idempotent-Replayed":{"description":"true when this is the stored answer to an earlier request with the same Idempotency-Key","schema":{"type":"string"}}}},"401":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["unauthorized"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"Missing, invalid or revoked credential"},"402":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["insufficient_credit"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"Not enough credit"},"403":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["forbidden","tenant_unavailable"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"Scope too low or tenant unavailable"},"409":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["name_taken","idempotency_in_progress"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"Name taken, or the first request with this Idempotency-Key is still running"},"422":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["idempotency_conflict"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"The Idempotency-Key was already used with a different request body"},"429":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["plan_limit","instance_limit","allowance_exhausted","free_capacity_reached","rate_limited"],"type":"string"},"error":{"type":"string"},"retry_after_s":{"description":"Same value as the Retry-After header","type":"integer"}},"required":["code","error"],"type":"object"}}},"description":"Plan, allowance or free-tier limit reached, or rate limit","headers":{"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}}},"503":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["capacity_full","paused"],"type":"string"},"error":{"type":"string"},"retry_after_s":{"description":"Same value as the Retry-After header","type":"integer"}},"required":["code","error"],"type":"object"}}},"description":"Global running-instance cap reached, or the operator paused creates and starts; retry after the Retry-After seconds","headers":{"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}}},"default":{"content":{"application/json":{"schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"error"}},"security":[{"bearer":[]}],"summary":"Provision a service (async, 202); budget and quota checked","x-required-scope":"deploy","x-sandbox":true}},"/v1/services/metrics":{"get":{"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"services":{"items":{"properties":{"error":{"nullable":true},"id":{"type":"string"},"metrics":{"properties":{"cpu_time_ms":{"type":"integer"},"rss_bytes":{"type":"integer"},"rx_bytes":{"type":"integer"},"state":{"type":"string"},"tx_bytes":{"type":"integer"},"uptime_ms":{"type":"integer"}},"required":["cpu_time_ms","rss_bytes","rx_bytes","state","tx_bytes","uptime_ms"],"type":"object"},"name":{"type":"string"}},"required":["id","metrics","name"],"type":"object"},"type":"array"},"truncated":{"type":"boolean"}},"required":["services","truncated"],"type":"object"}}},"description":"ok"},"401":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["unauthorized"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"Missing, invalid or revoked credential"},"403":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["forbidden","tenant_unavailable"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"Scope too low or tenant unavailable"},"429":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["rate_limited"],"type":"string"},"error":{"type":"string"},"retry_after_s":{"description":"Same value as the Retry-After header","type":"integer"}},"required":["code","error"],"type":"object"}}},"description":"Rate limit reached","headers":{"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}}},"default":{"content":{"application/json":{"schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"error"}},"security":[{"bearer":[]}],"summary":"Runtime 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","x-required-scope":"read","x-sandbox":true}},"/v1/services/{id}":{"delete":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}}],"responses":{"202":{"content":{"application/json":{"schema":{"properties":{"config":{"properties":{"max_db_bytes":{"type":"string"}},"type":"object"},"crash_loop":{"type":"boolean"},"created":{"type":"integer"},"expires_at":{"type":"integer"},"health":{"type":"string"},"id":{"type":"string"},"last_error":{"type":"string"},"memory_mb":{"type":"integer"},"name":{"type":"string"},"restarts":{"type":"integer"},"secrets":{"properties":{"API_KEY":{"type":"string"}},"type":"object"},"service":{"type":"string"},"state":{"type":"string"},"storage_chunks":{"type":"integer"},"ttl_s":{"type":"integer"},"url":{"type":"string"},"vcpus":{"type":"integer"},"volume_mb":{"type":"integer"}},"required":["crash_loop","created","expires_at","health","id","last_error","memory_mb","name","restarts","service","state","storage_chunks","ttl_s","url","vcpus","volume_mb"],"type":"object"}}},"description":"ok"},"401":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["unauthorized"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"Missing, invalid or revoked credential"},"403":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["forbidden","tenant_unavailable"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"Scope too low or tenant unavailable"},"404":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["not_found"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"No such resource (the same body for another tenant's id)"},"429":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["rate_limited"],"type":"string"},"error":{"type":"string"},"retry_after_s":{"description":"Same value as the Retry-After header","type":"integer"}},"required":["code","error"],"type":"object"}}},"description":"Rate limit reached","headers":{"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}}},"default":{"content":{"application/json":{"schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"error"}},"security":[{"bearer":[]}],"summary":"Delete a service and its volume (async)","x-required-scope":"deploy","x-sandbox":true},"get":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"config":{"properties":{"max_db_bytes":{"type":"string"}},"type":"object"},"crash_loop":{"type":"boolean"},"created":{"type":"integer"},"expires_at":{"type":"integer"},"health":{"type":"string"},"id":{"type":"string"},"last_error":{"type":"string"},"memory_mb":{"type":"integer"},"name":{"type":"string"},"restarts":{"type":"integer"},"secrets":{"properties":{"API_KEY":{"type":"string"}},"type":"object"},"service":{"type":"string"},"state":{"type":"string"},"storage_chunks":{"type":"integer"},"ttl_s":{"type":"integer"},"url":{"type":"string"},"vcpus":{"type":"integer"},"volume_mb":{"type":"integer"}},"required":["crash_loop","created","expires_at","health","id","last_error","memory_mb","name","restarts","service","state","storage_chunks","ttl_s","url","vcpus","volume_mb"],"type":"object"}}},"description":"ok"},"401":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["unauthorized"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"Missing, invalid or revoked credential"},"403":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["forbidden","tenant_unavailable"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"Scope too low or tenant unavailable"},"404":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["not_found"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"No such resource (the same body for another tenant's id)"},"429":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["rate_limited"],"type":"string"},"error":{"type":"string"},"retry_after_s":{"description":"Same value as the Retry-After header","type":"integer"}},"required":["code","error"],"type":"object"}}},"description":"Rate limit reached","headers":{"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}}},"default":{"content":{"application/json":{"schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"error"}},"security":[{"bearer":[]}],"summary":"Get one service","x-required-scope":"read","x-sandbox":true}},"/v1/services/{id}/extend":{"post":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"ttl_s":{"type":"integer"}},"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"config":{"properties":{"max_db_bytes":{"type":"string"}},"type":"object"},"crash_loop":{"type":"boolean"},"created":{"type":"integer"},"expires_at":{"type":"integer"},"health":{"type":"string"},"id":{"type":"string"},"last_error":{"type":"string"},"memory_mb":{"type":"integer"},"name":{"type":"string"},"restarts":{"type":"integer"},"secrets":{"properties":{"API_KEY":{"type":"string"}},"type":"object"},"service":{"type":"string"},"state":{"type":"string"},"storage_chunks":{"type":"integer"},"ttl_s":{"type":"integer"},"url":{"type":"string"},"vcpus":{"type":"integer"},"volume_mb":{"type":"integer"}},"required":["crash_loop","created","expires_at","health","id","last_error","memory_mb","name","restarts","service","state","storage_chunks","ttl_s","url","vcpus","volume_mb"],"type":"object"}}},"description":"ok"},"401":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["unauthorized"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"Missing, invalid or revoked credential"},"403":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["forbidden","tenant_unavailable"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"Scope too low or tenant unavailable"},"404":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["not_found"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"No such resource (the same body for another tenant's id)"},"429":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["rate_limited"],"type":"string"},"error":{"type":"string"},"retry_after_s":{"description":"Same value as the Retry-After header","type":"integer"}},"required":["code","error"],"type":"object"}}},"description":"Rate limit reached","headers":{"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}}},"default":{"content":{"application/json":{"schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"error"}},"security":[{"bearer":[]}],"summary":"Lengthen a service's lifetime by whole hours, up to the plan's maximum TTL","x-required-scope":"deploy","x-sandbox":true}},"/v1/services/{id}/logs":{"get":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"lines":{"type":"integer"},"logs":{"type":"string"}},"required":["lines","logs"],"type":"object"}}},"description":"ok"},"401":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["unauthorized"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"Missing, invalid or revoked credential"},"403":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["forbidden","tenant_unavailable"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"Scope too low or tenant unavailable"},"404":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["not_found"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"No such resource (the same body for another tenant's id)"},"429":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["rate_limited"],"type":"string"},"error":{"type":"string"},"retry_after_s":{"description":"Same value as the Retry-After header","type":"integer"}},"required":["code","error"],"type":"object"}}},"description":"Rate limit reached","headers":{"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}}},"default":{"content":{"application/json":{"schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"error"}},"security":[{"bearer":[]}],"summary":"Newest log lines of one service (query tail, 1..=1000, default 100); bearer tokens, platform token formats and the service's own secrets are redacted","x-required-scope":"deploy","x-sandbox":true}},"/v1/services/{id}/metrics":{"get":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"cpu_time_ms":{"type":"integer"},"rss_bytes":{"type":"integer"},"rx_bytes":{"type":"integer"},"state":{"type":"string"},"tx_bytes":{"type":"integer"},"uptime_ms":{"type":"integer"}},"required":["cpu_time_ms","rss_bytes","rx_bytes","state","tx_bytes","uptime_ms"],"type":"object"}}},"description":"ok"},"401":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["unauthorized"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"Missing, invalid or revoked credential"},"403":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["forbidden","tenant_unavailable"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"Scope too low or tenant unavailable"},"404":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["not_found"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"No such resource (the same body for another tenant's id)"},"429":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["rate_limited"],"type":"string"},"error":{"type":"string"},"retry_after_s":{"description":"Same value as the Retry-After header","type":"integer"}},"required":["code","error"],"type":"object"}}},"description":"Rate limit reached","headers":{"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}}},"default":{"content":{"application/json":{"schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"error"}},"security":[{"bearer":[]}],"summary":"Runtime 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","x-required-scope":"read","x-sandbox":true}},"/v1/services/{id}/reveal":{"post":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"config":{"properties":{"max_db_bytes":{"type":"string"}},"type":"object"},"crash_loop":{"type":"boolean"},"created":{"type":"integer"},"expires_at":{"type":"integer"},"health":{"type":"string"},"id":{"type":"string"},"last_error":{"type":"string"},"memory_mb":{"type":"integer"},"name":{"type":"string"},"restarts":{"type":"integer"},"secrets":{"properties":{"API_KEY":{"type":"string"}},"type":"object"},"service":{"type":"string"},"state":{"type":"string"},"storage_chunks":{"type":"integer"},"ttl_s":{"type":"integer"},"url":{"type":"string"},"vcpus":{"type":"integer"},"volume_mb":{"type":"integer"}},"required":["crash_loop","created","expires_at","health","id","last_error","memory_mb","name","restarts","service","state","storage_chunks","ttl_s","url","vcpus","volume_mb"],"type":"object"}}},"description":"ok"},"401":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["unauthorized"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"Missing, invalid or revoked credential"},"403":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["forbidden","tenant_unavailable"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"Scope too low or tenant unavailable"},"404":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["not_found"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"No such resource (the same body for another tenant's id)"},"429":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["rate_limited"],"type":"string"},"error":{"type":"string"},"retry_after_s":{"description":"Same value as the Retry-After header","type":"integer"}},"required":["code","error"],"type":"object"}}},"description":"Rate limit reached","headers":{"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}}},"default":{"content":{"application/json":{"schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"error"}},"security":[{"bearer":[]}],"summary":"Show 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","x-required-scope":"deploy","x-sandbox":true}},"/v1/services/{id}/start":{"post":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}}],"responses":{"202":{"content":{"application/json":{"schema":{"properties":{"config":{"properties":{"max_db_bytes":{"type":"string"}},"type":"object"},"crash_loop":{"type":"boolean"},"created":{"type":"integer"},"expires_at":{"type":"integer"},"health":{"type":"string"},"id":{"type":"string"},"last_error":{"type":"string"},"memory_mb":{"type":"integer"},"name":{"type":"string"},"restarts":{"type":"integer"},"secrets":{"properties":{"API_KEY":{"type":"string"}},"type":"object"},"service":{"type":"string"},"state":{"type":"string"},"storage_chunks":{"type":"integer"},"ttl_s":{"type":"integer"},"url":{"type":"string"},"vcpus":{"type":"integer"},"volume_mb":{"type":"integer"}},"required":["crash_loop","created","expires_at","health","id","last_error","memory_mb","name","restarts","service","state","storage_chunks","ttl_s","url","vcpus","volume_mb"],"type":"object"}}},"description":"ok"},"401":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["unauthorized"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"Missing, invalid or revoked credential"},"402":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["insufficient_credit"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"Not enough credit"},"403":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["forbidden","tenant_unavailable"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"Scope too low or tenant unavailable"},"404":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["not_found"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"No such resource (the same body for another tenant's id)"},"429":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["plan_limit","instance_limit","allowance_exhausted","free_capacity_reached","rate_limited"],"type":"string"},"error":{"type":"string"},"retry_after_s":{"description":"Same value as the Retry-After header","type":"integer"}},"required":["code","error"],"type":"object"}}},"description":"Plan, allowance or free-tier limit reached, or rate limit","headers":{"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}}},"503":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["capacity_full","paused"],"type":"string"},"error":{"type":"string"},"retry_after_s":{"description":"Same value as the Retry-After header","type":"integer"}},"required":["code","error"],"type":"object"}}},"description":"Global running-instance cap reached, or the operator paused creates and starts; retry after the Retry-After seconds","headers":{"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}}},"default":{"content":{"application/json":{"schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"error"}},"security":[{"bearer":[]}],"summary":"Start a stopped service (202: the response shows state running, the state it is moving to; GET confirms)","x-required-scope":"deploy","x-sandbox":true}},"/v1/services/{id}/stop":{"post":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}}],"responses":{"202":{"content":{"application/json":{"schema":{"properties":{"config":{"properties":{"max_db_bytes":{"type":"string"}},"type":"object"},"crash_loop":{"type":"boolean"},"created":{"type":"integer"},"expires_at":{"type":"integer"},"health":{"type":"string"},"id":{"type":"string"},"last_error":{"type":"string"},"memory_mb":{"type":"integer"},"name":{"type":"string"},"restarts":{"type":"integer"},"secrets":{"properties":{"API_KEY":{"type":"string"}},"type":"object"},"service":{"type":"string"},"state":{"type":"string"},"storage_chunks":{"type":"integer"},"ttl_s":{"type":"integer"},"url":{"type":"string"},"vcpus":{"type":"integer"},"volume_mb":{"type":"integer"}},"required":["crash_loop","created","expires_at","health","id","last_error","memory_mb","name","restarts","service","state","storage_chunks","ttl_s","url","vcpus","volume_mb"],"type":"object"}}},"description":"ok"},"401":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["unauthorized"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"Missing, invalid or revoked credential"},"403":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["forbidden","tenant_unavailable"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"Scope too low or tenant unavailable"},"404":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["not_found"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"No such resource (the same body for another tenant's id)"},"429":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["rate_limited"],"type":"string"},"error":{"type":"string"},"retry_after_s":{"description":"Same value as the Retry-After header","type":"integer"}},"required":["code","error"],"type":"object"}}},"description":"Rate limit reached","headers":{"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}}},"default":{"content":{"application/json":{"schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"error"}},"security":[{"bearer":[]}],"summary":"Stop a running service (volume kept, still billed; 202: the response shows state stopped, the state it is moving to; GET confirms)","x-required-scope":"deploy","x-sandbox":true}},"/v1/tokens":{"get":{"parameters":[{"description":"Page size, 1-500 (default 50, larger values are clamped). With limit or cursor the response is {items, next_cursor}, newest first; without either it is the plain, unpaged response","in":"query","name":"limit","required":false,"schema":{"maximum":500,"minimum":1,"type":"integer"}},{"description":"Opaque next_cursor from the previous page","in":"query","name":"cursor","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"tokens":{"items":{"properties":{"created_at":{"type":"integer"},"expires_at":{"type":"integer"},"id":{"type":"string"},"last_used_at":{"type":"integer"},"name":{"type":"string"},"prefix":{"type":"string"},"revoked_at":{"nullable":true},"scopes":{"items":{"type":"string"},"type":"array"}},"required":["created_at","expires_at","id","last_used_at","name","prefix","scopes"],"type":"object"},"type":"array"}},"required":["tokens"],"type":"object"}}},"description":"ok"},"400":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["bad_limit","bad_cursor"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"Bad limit or cursor"},"default":{"content":{"application/json":{"schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"error"}},"security":[{"bearer":[]},{"cookie":[]}],"summary":"List access tokens (never the secret)","x-auth":"session-or-token"},"post":{"requestBody":{"content":{"application/json":{"schema":{"properties":{"expires_in_days":{"type":"integer"},"name":{"type":"string"},"scopes":{"items":{"type":"string"},"type":"array"}},"type":"object"}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"properties":{"created_at":{"type":"integer"},"expires_at":{"type":"integer"},"id":{"type":"string"},"last_used_at":{"type":"integer"},"name":{"type":"string"},"prefix":{"type":"string"},"revoked_at":{"nullable":true},"scopes":{"items":{"type":"string"},"type":"array"},"token":{"type":"string"}},"required":["created_at","expires_at","id","last_used_at","name","prefix","scopes","token"],"type":"object"}}},"description":"ok"},"default":{"content":{"application/json":{"schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"error"}},"security":[{"bearer":[]},{"cookie":[]}],"summary":"Create an access token; the secret is returned once","x-auth":"session-or-token"}},"/v1/tokens/{id}":{"delete":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"id":{"type":"string"},"ok":{"type":"boolean"}},"required":["id","ok"],"type":"object"}}},"description":"ok"},"default":{"content":{"application/json":{"schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"error"}},"security":[{"bearer":[]},{"cookie":[]}],"summary":"Revoke a token immediately","x-auth":"session-or-token"}},"/v1/tokens/{id}/rotate":{"post":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}}],"responses":{"201":{"content":{"application/json":{"schema":{"properties":{"created_at":{"type":"integer"},"expires_at":{"type":"integer"},"id":{"type":"string"},"last_used_at":{"type":"integer"},"name":{"type":"string"},"prefix":{"type":"string"},"revoked_at":{"nullable":true},"scopes":{"items":{"type":"string"},"type":"array"},"token":{"type":"string"}},"required":["created_at","expires_at","id","last_used_at","name","prefix","scopes","token"],"type":"object"}}},"description":"ok"},"default":{"content":{"application/json":{"schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"error"}},"security":[{"bearer":[]},{"cookie":[]}],"summary":"New secret with the same name, scopes and lifetime; the old token is revoked","x-auth":"session-or-token"}},"/v1/usage":{"get":{"parameters":[{"description":"Page size, 1-500 (default 50, larger values are clamped). With limit or cursor the response is {items, next_cursor}, newest first; without either it is the plain, unpaged response","in":"query","name":"limit","required":false,"schema":{"maximum":500,"minimum":1,"type":"integer"}},{"description":"Opaque next_cursor from the previous page","in":"query","name":"cursor","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"balance_micro":{"type":"integer"},"from":{"type":"integer"},"records":{"items":{"properties":{"core_s":{"type":"integer"},"cost_micro":{"type":"integer"},"instance":{"type":"string"},"interval_s":{"type":"integer"},"interval_start":{"type":"integer"},"plan":{"type":"string"},"ram_mb_s":{"type":"integer"},"running_s":{"type":"integer"},"rx_bytes":{"type":"integer"},"tenant":{"type":"string"},"tx_bytes":{"type":"integer"},"units":{"type":"integer"},"vcpu_ms":{"type":"integer"},"volume_mb_s":{"type":"integer"}},"required":["core_s","cost_micro","instance","interval_s","interval_start","plan","ram_mb_s","running_s","rx_bytes","tenant","tx_bytes","units","vcpu_ms","volume_mb_s"],"type":"object"},"type":"array"},"tenant":{"type":"string"},"to":{"type":"integer"},"totals":{"properties":{"cost_micro":{"type":"integer"},"ram_mb_s":{"type":"integer"},"vcpu_s":{"type":"number"},"volume_gb_h":{"type":"number"}},"required":["cost_micro","ram_mb_s","vcpu_s","volume_gb_h"],"type":"object"},"units":{"properties":{"allowance":{"properties":{"core_hours":{"properties":{"limit":{"type":"number"},"remaining":{"type":"number"},"used":{"type":"number"}},"required":["limit","remaining","used"],"type":"object"},"mem_gib_hours":{"properties":{"limit":{"type":"number"},"remaining":{"type":"number"},"used":{"type":"number"}},"required":["limit","remaining","used"],"type":"object"},"outbound_mb":{"properties":{"limit":{"type":"number"},"remaining":{"type":"number"},"used":{"type":"number"}},"required":["limit","remaining","used"],"type":"object"},"period_end":{"type":"integer"},"period_start":{"type":"integer"},"storage_gib_hours":{"properties":{"limit":{"type":"number"},"remaining":{"type":"number"},"used":{"type":"number"}},"required":["limit","remaining","used"],"type":"object"}},"required":["core_hours","mem_gib_hours","outbound_mb","period_end","period_start","storage_gib_hours"],"type":"object"},"core_hours":{"type":"number"},"mem_gib_hours":{"type":"number"},"running_hours":{"type":"number"},"storage_gib_hours":{"type":"number"}},"required":["allowance","core_hours","mem_gib_hours","running_hours","storage_gib_hours"],"type":"object"}},"required":["balance_micro","from","records","tenant","to","totals","units"],"type":"object"}}},"description":"ok"},"400":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["bad_limit","bad_cursor"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"Bad limit or cursor"},"401":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["unauthorized"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"Missing, invalid or revoked credential"},"403":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["forbidden","tenant_unavailable"],"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"Scope too low or tenant unavailable"},"429":{"content":{"application/json":{"schema":{"properties":{"code":{"enum":["rate_limited"],"type":"string"},"error":{"type":"string"},"retry_after_s":{"description":"Same value as the Retry-After header","type":"integer"}},"required":["code","error"],"type":"object"}}},"description":"Rate limit reached","headers":{"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}}},"default":{"content":{"application/json":{"schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"error"}},"security":[{"bearer":[]}],"summary":"Usage ledger and balance; query from, to (unix seconds)","x-required-scope":"read","x-sandbox":true}},"/v1/webhooks/paddle":{"post":{"requestBody":{"content":{"application/json":{"schema":{"properties":{"data":{"properties":{"id":{"type":"string"},"status":{"type":"string"}},"type":"object"},"event_id":{"type":"string"},"event_type":{"type":"string"},"occurred_at":{"type":"string"}},"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"status":{"type":"string"}},"required":["status"],"type":"object"}}},"description":"ok"},"default":{"content":{"application/json":{"schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"}},"required":["code","error"],"type":"object"}}},"description":"error"}},"summary":"Payment 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"}}},"servers":[{"url":"https://api.microsaas.app","description":"Production API (documentation only; the console sandbox is login-gated)"}]}