{"openapi":"3.1.0","info":{"title":"Moonage API","version":"1.1.18","description":"## What this is\n\nInteractive API reference for `moonage-api`. Use the **Authorize** button (top-right) to paste a bearer JWT. Sign-in lives on the auth worker (`POST /v2/auth/sessions` on `moonage-auth-*`), not here — copy `data.accessToken` from its response.\n\n## Coverage\n\nPARTIAL, and deliberately honest about it. Every path below resolves to a real route on this worker — that is enforced in CI, which walks this document against the live Hono route table. What it does NOT yet cover is most of the `/v2` surface: agents, spaces, tasks, threads, memory, inbox, integrations and usage are all served and all undocumented. This page previously declared 66 operations, of which 38 pointed at nothing; those were removed rather than left to mislead. Auth is served by a separate worker and is out of scope here. Internal HMAC-v3-signed routes under `/internal/*` are intentionally not documented — they're service-to-service only.\n\n## Envelopes\n\nEvery response is wrapped: success responses are `{ success: true, data, requestId }`, errors are `{ success: false, error, code, requestId }`. See the `ErrorEnvelope` schema for the full error shape.","contact":{"name":"Moonage","email":"team@moonage.ai"}},"servers":[{"url":"https://api.moonage.ai","description":"Active server (this worker)."}],"tags":[{"name":"Orgs","description":"Org CRUD + invite issuance + member roles."},{"name":"Approvals","description":"Gateway escalation lifecycle + RBAC approval workflow."},{"name":"Conversations","description":"Mention routing + suggestion."},{"name":"Permissions","description":"Permission catalog + policy evaluation + RBAC."},{"name":"Admin","description":"Service health."},{"name":"Public","description":"Unauthenticated reads (model catalog)."}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Session JWT issued by the sign-in flow. Format: `Authorization: Bearer <token>`.\n\nSign-in is served by a DIFFERENT worker: `POST /v2/auth/sessions` on `moonage-auth-*`. It is not reachable from this page. This page used to instruct you to sign in against a path on THIS worker that has never existed; it no longer does. Get a token from the auth worker, then paste it into the \"Authorize\" dialog."}},"schemas":{"Org":{"type":"object","properties":{"id":{"type":"string","example":"org_01j8z2k4n5p6q7r8s9t0v1w2x3","description":"Canonical org ID (org_<ULID>)."},"name":{"type":"string","example":"Moonage"},"slug":{"type":"string","example":"moonage"},"ownerId":{"type":"string","example":"hum_01j8z2k4n5p6q7r8s9t0v1w2x3","description":"Canonical human ID (hum_<ULID>)."},"createdAt":{"type":"string","example":"2026-05-19T23:40:00Z","description":"ISO-8601 timestamp (UTC, with Z)."}},"required":["id","name","slug","ownerId","createdAt"],"additionalProperties":{}},"ErrorEnvelope":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"string","example":"Invalid credentials"},"code":{"type":"string","example":"AUTH_INVALID"},"details":{"type":"object","additionalProperties":{}},"suggestion":{"type":"string"},"requestId":{"type":"string","example":"req_01j8z1a2b3c4d5e6f7g8h9j0kl"}},"required":["success","error","code","requestId"]},"CreateOrgRequest":{"type":"object","properties":{"name":{"type":"string","minLength":1},"slug":{"type":"string","pattern":"^[a-z0-9-]+$","description":"URL slug; auto-derived from name if omitted."}},"required":["name"]},"UpdateOrgRequest":{"type":"object","properties":{"name":{"type":"string","minLength":1},"slug":{"type":"string","pattern":"^[a-z0-9-]+$"}}},"Invite":{"type":"object","properties":{"id":{"type":"string"},"token":{"type":"string"},"orgId":{"type":"string","example":"org_01j8z2k4n5p6q7r8s9t0v1w2x3","description":"Canonical org ID (org_<ULID>)."},"email":{"type":"string","format":"email"},"role":{"type":"string","enum":["owner","admin","member","guest"]},"status":{"type":"string","enum":["pending","accepted","revoked","expired"]},"createdAt":{"type":"string","example":"2026-05-19T23:40:00Z","description":"ISO-8601 timestamp (UTC, with Z)."},"expiresAt":{"type":["string","null"],"example":"2026-05-19T23:40:00Z","description":"ISO-8601 timestamp (UTC, with Z)."}},"required":["id","orgId","email","role","status","createdAt"],"additionalProperties":{}},"CreateInviteRequest":{"type":"object","properties":{"email":{"type":"string","format":"email"},"role":{"type":"string","enum":["owner","admin","member","guest"],"default":"member"}},"required":["email"]},"UpdateOrgMemberRoleRequest":{"type":"object","properties":{"role":{"type":"string","enum":["owner","admin","member","guest"]}},"required":["role"]},"CreateApprovalResponse":{"type":"object","properties":{"id":{"type":"string","description":"`apr_*` card id."}},"required":["id"],"additionalProperties":{}},"CreateApprovalRequest":{"type":"object","properties":{"orgId":{"type":"string","minLength":1},"humanId":{"type":"string","minLength":1},"conversationId":{"type":"string","minLength":1},"agentId":{"type":["string","null"]},"riskTier":{"type":"string","enum":["read","write","send"]},"planJson":{"type":"object","additionalProperties":{},"description":"Serialized `PlanSchema` from contracts."},"evidenceJson":{"type":"object","additionalProperties":{}}},"required":["orgId","humanId","conversationId","agentId","riskTier","planJson","evidenceJson"],"additionalProperties":{}},"ResolveApprovalRequest":{"type":"object","properties":{"decision":{"type":"string","enum":["approved","denied"]},"humanId":{"type":"string","minLength":1}},"required":["decision","humanId"],"additionalProperties":{}},"MentionSuggestResponse":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"suggestions":{"type":"array","items":{"$ref":"#/components/schemas/MentionSuggestion"}},"data":{"type":"object","properties":{"suggestions":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["agent"]},"id":{"type":"string"},"slug":{"type":"string"},"spaceId":{"type":["string","null"]},"displayName":{"type":"string"},"emailLocalPart":{"type":"string"}},"required":["type","id","slug","spaceId"],"additionalProperties":{}}}},"required":["suggestions"]}},"required":["ok","suggestions","data"],"additionalProperties":{}},"MentionSuggestion":{"type":"object","properties":{"type":{"type":"string","enum":["agent"]},"id":{"type":"string"},"slug":{"type":"string"},"spaceId":{"type":["string","null"]},"displayName":{"type":"string"},"emailLocalPart":{"type":"string"}},"required":["type","id","slug","spaceId"],"additionalProperties":{}},"PermissionCheckRequest":{"type":"object","properties":{"permission":{"type":"string"},"resource":{"type":"string"}},"required":["permission"],"additionalProperties":{}},"PolicyEvaluateRequest":{"type":"object","properties":{},"additionalProperties":{}},"CreateOrgPolicyRequest":{"type":"object","properties":{},"additionalProperties":{}},"PatchOrgPolicyRequest":{"type":"object","properties":{},"additionalProperties":{}},"CreateSpacePolicyRequest":{"type":"object","properties":{},"additionalProperties":{}},"PatchSpacePolicyRequest":{"type":"object","properties":{},"additionalProperties":{}}},"parameters":{}},"paths":{"/v2/orgs":{"post":{"tags":["Orgs"],"summary":"Create an org","security":[{"BearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateOrgRequest"}}}},"responses":{"201":{"description":"Org created.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/Org"},"message":{"type":"string"},"meta":{"type":"object","additionalProperties":{}},"requestId":{"type":"string","example":"req_01j8z1a2b3c4d5e6f7g8h9j0kl"}},"required":["success","data","requestId"]}}}},"400":{"description":"Bad request — validation failed or input malformed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"Unauthorized — missing, invalid, or expired bearer token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"Forbidden — RBAC denied for the active actor.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"Rate limit exceeded.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}}},"/v2/orgs/{orgId}":{"get":{"tags":["Orgs"],"summary":"Get an org by ID","security":[{"BearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"orgId","in":"path"}],"responses":{"200":{"description":"Org details.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/Org"},"message":{"type":"string"},"meta":{"type":"object","additionalProperties":{}},"requestId":{"type":"string","example":"req_01j8z1a2b3c4d5e6f7g8h9j0kl"}},"required":["success","data","requestId"]}}}},"400":{"description":"Bad request — validation failed or input malformed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"Unauthorized — missing, invalid, or expired bearer token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"Forbidden — RBAC denied for the active actor.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"Rate limit exceeded.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}},"patch":{"tags":["Orgs"],"summary":"Update org name / slug","description":"Requires `owner` or `admin` role in the org.","security":[{"BearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"orgId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateOrgRequest"}}}},"responses":{"200":{"description":"Org updated.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/Org"},"message":{"type":"string"},"meta":{"type":"object","additionalProperties":{}},"requestId":{"type":"string","example":"req_01j8z1a2b3c4d5e6f7g8h9j0kl"}},"required":["success","data","requestId"]}}}},"400":{"description":"Bad request — validation failed or input malformed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"Unauthorized — missing, invalid, or expired bearer token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"Forbidden — RBAC denied for the active actor.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"Rate limit exceeded.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}},"delete":{"tags":["Orgs"],"summary":"Delete an org","description":"Owner-only. Soft-deletes the org and schedules cleanup via the daily outbox processor.","security":[{"BearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"orgId","in":"path"}],"responses":{"200":{"description":"Org delete queued.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{"orgId":{"type":"string"},"status":{"type":"string","enum":["deletion_queued"]}},"required":["orgId","status"]},"message":{"type":"string"},"meta":{"type":"object","additionalProperties":{}},"requestId":{"type":"string","example":"req_01j8z1a2b3c4d5e6f7g8h9j0kl"}},"required":["success","data","requestId"]}}}},"400":{"description":"Bad request — validation failed or input malformed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"Unauthorized — missing, invalid, or expired bearer token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"Forbidden — RBAC denied for the active actor.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"Rate limit exceeded.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}}},"/v2/orgs/{orgId}/invites":{"post":{"tags":["Orgs"],"summary":"Invite a member to an org","description":"Requires `owner` or `admin` role.","security":[{"BearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"orgId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateInviteRequest"}}}},"responses":{"201":{"description":"Invite created + email sent.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/Invite"},"message":{"type":"string"},"meta":{"type":"object","additionalProperties":{}},"requestId":{"type":"string","example":"req_01j8z1a2b3c4d5e6f7g8h9j0kl"}},"required":["success","data","requestId"]}}}},"400":{"description":"Bad request — validation failed or input malformed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"Unauthorized — missing, invalid, or expired bearer token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"Forbidden — RBAC denied for the active actor.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"Rate limit exceeded.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}},"get":{"tags":["Orgs"],"summary":"List pending invites for an org","security":[{"BearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"orgId","in":"path"}],"responses":{"200":{"description":"Pending invites.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"$ref":"#/components/schemas/Invite"}},"message":{"type":"string"},"meta":{"type":"object","additionalProperties":{}},"requestId":{"type":"string","example":"req_01j8z1a2b3c4d5e6f7g8h9j0kl"}},"required":["success","data","requestId"]}}}},"400":{"description":"Bad request — validation failed or input malformed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"Unauthorized — missing, invalid, or expired bearer token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"Forbidden — RBAC denied for the active actor.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"Rate limit exceeded.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}}},"/v2/orgs/{orgId}/members/{memberId}/role":{"patch":{"tags":["Orgs"],"summary":"Change a member's role","security":[{"BearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"orgId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"memberId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateOrgMemberRoleRequest"}}}},"responses":{"200":{"description":"Role updated.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{"member":{"type":"object","properties":{"id":{"type":"string"},"role":{"type":"string"}},"required":["id","role"]}},"required":["member"]},"message":{"type":"string"},"meta":{"type":"object","additionalProperties":{}},"requestId":{"type":"string","example":"req_01j8z1a2b3c4d5e6f7g8h9j0kl"}},"required":["success","data","requestId"]}}}},"400":{"description":"Bad request — validation failed or input malformed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"Unauthorized — missing, invalid, or expired bearer token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"Forbidden — RBAC denied for the active actor.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"Rate limit exceeded.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}}},"/v2/approvals":{"post":{"tags":["Approvals"],"summary":"Create a gateway escalation card","description":"Wave F2 of the moon-gateway rebuild. Persists an approval card in `app.gateway_approval_requests` (migration 0117). Called by moon-gateway's `runtime.escalate()` whenever a high-risk plan needs human sign-off before execution. Service-to-service only. Signed via HMAC v3/v4 (`X-Internal-Call-Signature` header per `buildAuthHeaders` from `@moonage-inc/contracts`). Not callable by browser clients. The body `orgId` MUST match the caller's signed orgId — cross-tenant writes are rejected with 403.","security":[],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateApprovalRequest"}}}},"responses":{"201":{"description":"Approval card created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateApprovalResponse"}}}},"400":{"description":"Bad request — validation failed or input malformed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"Unauthorized — missing, invalid, or expired bearer token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"Forbidden — RBAC denied for the active actor.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"Rate limit exceeded.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}}},"/v2/approvals/{id}/resolve":{"post":{"tags":["Approvals"],"summary":"Resolve a gateway escalation card","description":"Marks an `app.gateway_approval_requests` row as `approved` or `denied`, stamping `resolved_at` and `resolved_by_human_id`. Idempotent: re-resolving a card that is no longer `pending` returns 404 (the terminal state is preserved). Service-to-service only. Signed via HMAC v3/v4 (`X-Internal-Call-Signature` header). Not callable by browser clients. The card's `org_id` must match the caller's signed orgId.","security":[],"parameters":[{"schema":{"type":"string","description":"`apr_*` card id."},"required":true,"description":"`apr_*` card id.","name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResolveApprovalRequest"}}}},"responses":{"200":{"description":"Card resolved.","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]}},"required":["ok"],"additionalProperties":{}}}}},"400":{"description":"Bad request — validation failed or input malformed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"Unauthorized — missing, invalid, or expired bearer token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"Forbidden — RBAC denied for the active actor.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"Rate limit exceeded.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}}},"/v2/mention/suggest":{"get":{"tags":["Conversations"],"summary":"Resolve agent mentions (autocomplete or batch by slug)","description":"Two query modes share one route. `?q=<prefix>&spaceId=<spc>` runs a case-insensitive ILIKE prefix autocomplete scoped to the space (joined via `app.space_members` with `member_kind='agent'`) for the chat compose UI's @-picker. `?slugs=a,b,c` resolves an exact-slug batch (org-scoped via `agents.org_id = caller.orgId`) for moonage-chat's `resolveMentions` when persisting `messages.mentions_json`. Accepts both Bearer JWT (browser) and HMAC service-binding callers (moonage-chat → moonage-api). HMAC callers with `budgetType=internal` bypass per-user role checks but are still org-scoped by their signed AuthContext. Result limit: 10.","security":[{"BearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"Prefix string for autocomplete mode. Requires `spaceId`."},"required":false,"description":"Prefix string for autocomplete mode. Requires `spaceId`.","name":"q","in":"query"},{"schema":{"type":"string","description":"Comma-separated slugs for batch mode (max 50)."},"required":false,"description":"Comma-separated slugs for batch mode (max 50).","name":"slugs","in":"query"},{"schema":{"type":"string","description":"Required when using `?q=`; ignored in slug mode."},"required":false,"description":"Required when using `?q=`; ignored in slug mode.","name":"spaceId","in":"query"}],"responses":{"200":{"description":"Mention suggestions.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MentionSuggestResponse"}}}},"400":{"description":"Bad request — validation failed or input malformed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"Unauthorized — missing, invalid, or expired bearer token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"Forbidden — RBAC denied for the active actor.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"Rate limit exceeded.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}}},"/admin/health":{"get":{"tags":["Admin"],"summary":"Admin health dashboard payload","security":[{"BearerAuth":[]}],"responses":{"200":{"description":"Cluster health snapshot.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{},"additionalProperties":{}},"message":{"type":"string"},"meta":{"type":"object","additionalProperties":{}},"requestId":{"type":"string","example":"req_01j8z1a2b3c4d5e6f7g8h9j0kl"}},"required":["success","data","requestId"]}}}},"400":{"description":"Bad request — validation failed or input malformed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"Unauthorized — missing, invalid, or expired bearer token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"Forbidden — RBAC denied for the active actor.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"Rate limit exceeded.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}}},"/permissions":{"get":{"tags":["Permissions"],"summary":"List the static permission catalog","security":[{"BearerAuth":[]}],"responses":{"200":{"description":"Static permission catalog.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}},"message":{"type":"string"},"meta":{"type":"object","additionalProperties":{}},"requestId":{"type":"string","example":"req_01j8z1a2b3c4d5e6f7g8h9j0kl"}},"required":["success","data","requestId"]}}}},"400":{"description":"Bad request — validation failed or input malformed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"Unauthorized — missing, invalid, or expired bearer token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"Forbidden — RBAC denied for the active actor.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"Rate limit exceeded.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}}},"/permissions/catalog":{"get":{"tags":["Permissions"],"summary":"Permission catalog (alias)","security":[{"BearerAuth":[]}],"responses":{"200":{"description":"Permission catalog.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}},"message":{"type":"string"},"meta":{"type":"object","additionalProperties":{}},"requestId":{"type":"string","example":"req_01j8z1a2b3c4d5e6f7g8h9j0kl"}},"required":["success","data","requestId"]}}}},"400":{"description":"Bad request — validation failed or input malformed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"Unauthorized — missing, invalid, or expired bearer token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"Forbidden — RBAC denied for the active actor.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"Rate limit exceeded.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}}},"/me/permissions":{"get":{"tags":["Permissions"],"summary":"Get the caller's effective permissions","security":[{"BearerAuth":[]}],"responses":{"200":{"description":"Effective permissions for the active human.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}},"message":{"type":"string"},"meta":{"type":"object","additionalProperties":{}},"requestId":{"type":"string","example":"req_01j8z1a2b3c4d5e6f7g8h9j0kl"}},"required":["success","data","requestId"]}}}},"400":{"description":"Bad request — validation failed or input malformed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"Unauthorized — missing, invalid, or expired bearer token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"Forbidden — RBAC denied for the active actor.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"Rate limit exceeded.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}}},"/me/permissions/check":{"post":{"tags":["Permissions"],"summary":"Check whether the caller has a specific permission","security":[{"BearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PermissionCheckRequest"}}}},"responses":{"200":{"description":"Permission check result.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{"allowed":{"type":"boolean"}},"required":["allowed"],"additionalProperties":{}},"message":{"type":"string"},"meta":{"type":"object","additionalProperties":{}},"requestId":{"type":"string","example":"req_01j8z1a2b3c4d5e6f7g8h9j0kl"}},"required":["success","data","requestId"]}}}},"400":{"description":"Bad request — validation failed or input malformed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"Unauthorized — missing, invalid, or expired bearer token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"Forbidden — RBAC denied for the active actor.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"Rate limit exceeded.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}}},"/policies":{"get":{"tags":["Permissions"],"summary":"List policies visible to the caller","security":[{"BearerAuth":[]}],"responses":{"200":{"description":"Policies.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}},"message":{"type":"string"},"meta":{"type":"object","additionalProperties":{}},"requestId":{"type":"string","example":"req_01j8z1a2b3c4d5e6f7g8h9j0kl"}},"required":["success","data","requestId"]}}}},"400":{"description":"Bad request — validation failed or input malformed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"Unauthorized — missing, invalid, or expired bearer token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"Forbidden — RBAC denied for the active actor.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"Rate limit exceeded.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}}},"/policies/evaluate":{"post":{"tags":["Permissions"],"summary":"Dry-run a policy evaluation","description":"Evaluates the policy engine against a hypothetical context without persisting any decision.","security":[{"BearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PolicyEvaluateRequest"}}}},"responses":{"200":{"description":"Evaluation result.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{},"additionalProperties":{}},"message":{"type":"string"},"meta":{"type":"object","additionalProperties":{}},"requestId":{"type":"string","example":"req_01j8z1a2b3c4d5e6f7g8h9j0kl"}},"required":["success","data","requestId"]}}}},"400":{"description":"Bad request — validation failed or input malformed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"Unauthorized — missing, invalid, or expired bearer token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"Forbidden — RBAC denied for the active actor.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"Rate limit exceeded.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}}},"/orgs/{orgId}/policies":{"get":{"tags":["Permissions"],"summary":"List policies attached to an org","security":[{"BearerAuth":[]}],"parameters":[{"schema":{"type":"string","example":"org_01j8z2k4n5p6q7r8s9t0v1w2x3","description":"Canonical org ID (org_<ULID>)."},"required":true,"description":"Canonical org ID (org_<ULID>).","name":"orgId","in":"path"}],"responses":{"200":{"description":"Org policies.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}},"message":{"type":"string"},"meta":{"type":"object","additionalProperties":{}},"requestId":{"type":"string","example":"req_01j8z1a2b3c4d5e6f7g8h9j0kl"}},"required":["success","data","requestId"]}}}},"400":{"description":"Bad request — validation failed or input malformed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"Unauthorized — missing, invalid, or expired bearer token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"Forbidden — RBAC denied for the active actor.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"Rate limit exceeded.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}},"post":{"tags":["Permissions"],"summary":"Create an org-level policy","security":[{"BearerAuth":[]}],"parameters":[{"schema":{"type":"string","example":"org_01j8z2k4n5p6q7r8s9t0v1w2x3","description":"Canonical org ID (org_<ULID>)."},"required":true,"description":"Canonical org ID (org_<ULID>).","name":"orgId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateOrgPolicyRequest"}}}},"responses":{"201":{"description":"Policy created.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{},"additionalProperties":{}},"message":{"type":"string"},"meta":{"type":"object","additionalProperties":{}},"requestId":{"type":"string","example":"req_01j8z1a2b3c4d5e6f7g8h9j0kl"}},"required":["success","data","requestId"]}}}},"400":{"description":"Bad request — validation failed or input malformed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"Unauthorized — missing, invalid, or expired bearer token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"Forbidden — RBAC denied for the active actor.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"Rate limit exceeded.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}}},"/orgs/{orgId}/policies/{policyId}":{"get":{"tags":["Permissions"],"summary":"Get a single org policy","security":[{"BearerAuth":[]}],"parameters":[{"schema":{"type":"string","example":"org_01j8z2k4n5p6q7r8s9t0v1w2x3","description":"Canonical org ID (org_<ULID>)."},"required":true,"description":"Canonical org ID (org_<ULID>).","name":"orgId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"policyId","in":"path"}],"responses":{"200":{"description":"Policy.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{},"additionalProperties":{}},"message":{"type":"string"},"meta":{"type":"object","additionalProperties":{}},"requestId":{"type":"string","example":"req_01j8z1a2b3c4d5e6f7g8h9j0kl"}},"required":["success","data","requestId"]}}}},"400":{"description":"Bad request — validation failed or input malformed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"Unauthorized — missing, invalid, or expired bearer token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"Forbidden — RBAC denied for the active actor.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"Rate limit exceeded.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}},"patch":{"tags":["Permissions"],"summary":"Update an org policy","security":[{"BearerAuth":[]}],"parameters":[{"schema":{"type":"string","example":"org_01j8z2k4n5p6q7r8s9t0v1w2x3","description":"Canonical org ID (org_<ULID>)."},"required":true,"description":"Canonical org ID (org_<ULID>).","name":"orgId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"policyId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PatchOrgPolicyRequest"}}}},"responses":{"200":{"description":"Policy updated.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{},"additionalProperties":{}},"message":{"type":"string"},"meta":{"type":"object","additionalProperties":{}},"requestId":{"type":"string","example":"req_01j8z1a2b3c4d5e6f7g8h9j0kl"}},"required":["success","data","requestId"]}}}},"400":{"description":"Bad request — validation failed or input malformed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"Unauthorized — missing, invalid, or expired bearer token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"Forbidden — RBAC denied for the active actor.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"Rate limit exceeded.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}},"delete":{"tags":["Permissions"],"summary":"Delete an org policy","security":[{"BearerAuth":[]}],"parameters":[{"schema":{"type":"string","example":"org_01j8z2k4n5p6q7r8s9t0v1w2x3","description":"Canonical org ID (org_<ULID>)."},"required":true,"description":"Canonical org ID (org_<ULID>).","name":"orgId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"policyId","in":"path"}],"responses":{"200":{"description":"Policy deleted.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{"deleted":{"type":"boolean","enum":[true]}},"required":["deleted"]},"message":{"type":"string"},"meta":{"type":"object","additionalProperties":{}},"requestId":{"type":"string","example":"req_01j8z1a2b3c4d5e6f7g8h9j0kl"}},"required":["success","data","requestId"]}}}},"400":{"description":"Bad request — validation failed or input malformed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"Unauthorized — missing, invalid, or expired bearer token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"Forbidden — RBAC denied for the active actor.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"Rate limit exceeded.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}}},"/spaces/{spaceId}/policies":{"get":{"tags":["Permissions"],"summary":"List policies attached to a space","security":[{"BearerAuth":[]}],"parameters":[{"schema":{"type":"string","example":"spc_01j8z2k4n5p6q7r8s9t0v1w2x3","description":"Canonical space ID (spc_<ULID>)."},"required":true,"description":"Canonical space ID (spc_<ULID>).","name":"spaceId","in":"path"}],"responses":{"200":{"description":"Space policies.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}},"message":{"type":"string"},"meta":{"type":"object","additionalProperties":{}},"requestId":{"type":"string","example":"req_01j8z1a2b3c4d5e6f7g8h9j0kl"}},"required":["success","data","requestId"]}}}},"400":{"description":"Bad request — validation failed or input malformed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"Unauthorized — missing, invalid, or expired bearer token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"Forbidden — RBAC denied for the active actor.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"Rate limit exceeded.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}},"post":{"tags":["Permissions"],"summary":"Create a space-level policy","security":[{"BearerAuth":[]}],"parameters":[{"schema":{"type":"string","example":"spc_01j8z2k4n5p6q7r8s9t0v1w2x3","description":"Canonical space ID (spc_<ULID>)."},"required":true,"description":"Canonical space ID (spc_<ULID>).","name":"spaceId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateSpacePolicyRequest"}}}},"responses":{"201":{"description":"Policy created.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{},"additionalProperties":{}},"message":{"type":"string"},"meta":{"type":"object","additionalProperties":{}},"requestId":{"type":"string","example":"req_01j8z1a2b3c4d5e6f7g8h9j0kl"}},"required":["success","data","requestId"]}}}},"400":{"description":"Bad request — validation failed or input malformed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"Unauthorized — missing, invalid, or expired bearer token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"Forbidden — RBAC denied for the active actor.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"Rate limit exceeded.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}}},"/spaces/{spaceId}/policies/{policyId}":{"get":{"tags":["Permissions"],"summary":"Get a single space policy","security":[{"BearerAuth":[]}],"parameters":[{"schema":{"type":"string","example":"spc_01j8z2k4n5p6q7r8s9t0v1w2x3","description":"Canonical space ID (spc_<ULID>)."},"required":true,"description":"Canonical space ID (spc_<ULID>).","name":"spaceId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"policyId","in":"path"}],"responses":{"200":{"description":"Policy.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{},"additionalProperties":{}},"message":{"type":"string"},"meta":{"type":"object","additionalProperties":{}},"requestId":{"type":"string","example":"req_01j8z1a2b3c4d5e6f7g8h9j0kl"}},"required":["success","data","requestId"]}}}},"400":{"description":"Bad request — validation failed or input malformed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"Unauthorized — missing, invalid, or expired bearer token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"Forbidden — RBAC denied for the active actor.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"Rate limit exceeded.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}},"patch":{"tags":["Permissions"],"summary":"Update a space policy","security":[{"BearerAuth":[]}],"parameters":[{"schema":{"type":"string","example":"spc_01j8z2k4n5p6q7r8s9t0v1w2x3","description":"Canonical space ID (spc_<ULID>)."},"required":true,"description":"Canonical space ID (spc_<ULID>).","name":"spaceId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"policyId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PatchSpacePolicyRequest"}}}},"responses":{"200":{"description":"Policy updated.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{},"additionalProperties":{}},"message":{"type":"string"},"meta":{"type":"object","additionalProperties":{}},"requestId":{"type":"string","example":"req_01j8z1a2b3c4d5e6f7g8h9j0kl"}},"required":["success","data","requestId"]}}}},"400":{"description":"Bad request — validation failed or input malformed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"Unauthorized — missing, invalid, or expired bearer token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"Forbidden — RBAC denied for the active actor.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"Rate limit exceeded.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}},"delete":{"tags":["Permissions"],"summary":"Delete a space policy","security":[{"BearerAuth":[]}],"parameters":[{"schema":{"type":"string","example":"spc_01j8z2k4n5p6q7r8s9t0v1w2x3","description":"Canonical space ID (spc_<ULID>)."},"required":true,"description":"Canonical space ID (spc_<ULID>).","name":"spaceId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"policyId","in":"path"}],"responses":{"200":{"description":"Policy deleted.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"object","properties":{"deleted":{"type":"boolean","enum":[true]}},"required":["deleted"]},"message":{"type":"string"},"meta":{"type":"object","additionalProperties":{}},"requestId":{"type":"string","example":"req_01j8z1a2b3c4d5e6f7g8h9j0kl"}},"required":["success","data","requestId"]}}}},"400":{"description":"Bad request — validation failed or input malformed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"Unauthorized — missing, invalid, or expired bearer token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"Forbidden — RBAC denied for the active actor.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"Rate limit exceeded.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}}},"/models":{"get":{"tags":["Public"],"summary":"List supported AI models","description":"Public, unauthenticated. Returns the canonical model catalog with capabilities and pricing tiers.","responses":{"200":{"description":"Model catalog.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"data":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}},"message":{"type":"string"},"meta":{"type":"object","additionalProperties":{}},"requestId":{"type":"string","example":"req_01j8z1a2b3c4d5e6f7g8h9j0kl"}},"required":["success","data","requestId"]}}}},"400":{"description":"Bad request — validation failed or input malformed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"Unauthorized — missing, invalid, or expired bearer token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"Forbidden — RBAC denied for the active actor.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"Rate limit exceeded.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}}}},"webhooks":{}}